BookmarkSubscribeRSS Feed
SumitBajaj
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?

1 REPLY 1
Rick_SAS
SAS Super FREQ

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. 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 654 views
  • 0 likes
  • 2 in conversation