pyGAM icon indicating copy to clipboard operation
pyGAM copied to clipboard

[Q] GAM results of Pygam's GAM and mgcv GAM are not matching

Open MRanka29 opened this issue 1 year ago • 1 comments

Hi,

I am using GAM of Pygam and comparing the coefficients of the fit with the gam model of MGCV.

Below is the code snipet and the coefficient results of when I use GAM model of Pygam

Code Snipet - Pygam's GAM

image

Coefficient Results - Pygam's GAM

image

Code Snipet - GAM of mgcv package in R

image

Coefficient Results - GAM of mgcv package in R

image

The coefficients of both the fit don't match. Am I missing something here?

Thanks in Advance!

MRanka29 avatar Jul 15 '24 19:07 MRanka29

hi @MRanka29 OK so from what i can see this amounts to a big linear model... I am not sure why the coefficients are so different, but it is hard to tell since internally both may be using different amounts of regularization (L2, etc) to stabilize the optimization problem. can you show the model summary for the pyGAM model? it would be nice to see if pyGAM agrees with MGCV on the significance (although here too i am aware that they are using different significance tests). At least the intercept is similar in both...

dswah avatar Dec 05 '25 09:12 dswah