[R] Discrepancy between gam from gam package and gam in S-PLUS
John Fox
jfox at mcmaster.ca
Tue Apr 19 01:08:06 CEST 2005
Dear Trevor,
I've noticed a discrepancy in the degrees of freedom reported by gam() from
the gam package in R vs. gam() in S-PLUS. The nonparametric df differ by 1;
otherwise (except for things that depend upon the df), the output is the
same:
--------- snip ------------
*** From R (gam version 0.93):
> mod.gam <- gam(prestige ~ lo(income, span=.6), data=Prestige)
> summary(mod.gam)
Call: gam(formula = prestige ~ lo(income, span = 0.6), data = Prestige)
Deviance Residuals:
Min 1Q Median 3Q Max
-17.163 -8.205 -1.998 8.070 32.326
(Dispersion Parameter for gaussian family taken to be 122.5047)
Null Deviance: 29895.43 on 101 degrees of freedom
Residual Deviance: 12004.72 on 97.9939 degrees of freedom
AIC: 785.82
Number of Local Scoring Iterations: 2
DF for Terms and F-values for Nonparametric Effects
Df Npar Df Npar F Pr(F)
(Intercept) 1
lo(income, span = 0.6) 1 2 10.626 6.537e-05 ***
---
Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1
*** From S-PLUS 6.2.1 for Windows:
> library(car)
> mod.gam <- gam(prestige ~ lo(income, span=.6), data=Prestige)
> summary(mod.gam)
Call: gam(formula = prestige ~ lo(income, span = 0.6), data = Prestige)
Deviance Residuals:
Min 1Q Median 3Q Max
-17.16264 -8.205246 -1.997525 8.070375 32.32608
(Dispersion Parameter for Gaussian family taken to be 123.7677 )
Null Deviance: 29895.43 on 101 degrees of freedom
Residual Deviance: 12004.72 on 96.99392 degrees of freedom
Number of Local Scoring Iterations: 1
DF for Terms and F-values for Nonparametric Effects
Df Npar Df Npar F Pr(F)
(Intercept) 1
lo(income, span = 0.6) 1 3 7.018995 0.0002517358
>
--------- snip ------------
I suppose that one of these must be in error.
Regards,
John
--------------------------------
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4
905-525-9140x23604
http://socserv.mcmaster.ca/jfox
More information about the R-help
mailing list