Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inquiry on Discrepancies Between pyGAM and R GAM Model Results #345

Open
Wenhuan2516 opened this issue Mar 1, 2024 · 0 comments
Open

Inquiry on Discrepancies Between pyGAM and R GAM Model Results #345

Wenhuan2516 opened this issue Mar 1, 2024 · 0 comments

Comments

@Wenhuan2516
Copy link

Dear pyGAM Developer Team,

I am writing to seek clarification on an issue I have encountered while using the pyGAM package. Specifically, I have noticed discrepancies in the results when fitting a Generalized Additive Model using pyGAM with Python, as compared to using the mgcv package in R, despite using the same dataset and equivalent model specifications.
To provide a brief context, I am analyzing the relationship between daily temperature and suicide rates. I am fitting GAMs to subgroups of my data, such as by gender and age groups, and while the results in R seem to be consistent with my expectations, the outcomes produced by pyGAM are notably different.
Could you offer any insights into why there might be differences in the results between the two packages? Are there any inherent differences in the default settings or the algorithms used by pyGAM that could account for such discrepancies? Here is a brief overview of the model I am fitting:
model = LinearGAM(s(0, n_splines=7) + s(1, n_splines=7) + s(2, n_splines=14) + f(3)).fit(X, y), while s0 is temperature, s1 is precipitation, s2 is date, f3 is national holidays.
In R, I am using the equivalent gam function from the mgcv package with similar spline specifications.
Understanding these differences is crucial for the integrity of my research, and any guidance you can provide would be greatly appreciated. Additionally, if there are recommended practices for ensuring the comparability of GAM results across different software implementations, I would be eager to learn more about them.
PDP
male
female
race_white

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant