BookmarkSubscribeRSS Feed
Calcite | Level 5

I am trying to run Ridge Regression in SAS and Python/PySpark but I am getting different beta estimates. How can I get similar outputs from both SAS and Python/PySpark?


I don't understand why this message is posted to the SAS IML Community. Are you running the ridge regression in PROC IML? Or should I move this question to the Statistical Communities forum?


You don't specify how you are computing the ridge statistic in either software, so we don't have much information about your problem. You also don't say if the results differ by a small amount (1E-3) or if the results are vastly different.


The documentation for PROC REG describes the formula used to compute ridge regression in SAS when you specify the RIDGE= option. The first thing you should do is compare the REG formula to the documentation of the other software. 


The REG procedure uses a fixed set of ridge parameters that you specify. Other software might try to choose the ridge parameter dynamically to optimize some statistic. I don't know what your Python package is doing, so check the documentation.


In general, it is difficult to comparing the results from two different software. They may use different methods for solving linear systems, different algorithms to optimize an objective function, and different default values for optional parameters. Ultimately, you need to search the documentation (or the source code, if you are using OSS) to ensure that both methods use the same parameter and algorithm. 


Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.


Register now!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

From The DO Loop
Want more? Visit our blog for more articles like these.
Discussion stats
  • 1 reply
  • 2 in conversation