[R] GLM results different from GAM results without smoothing terms
Prof Brian Ripley
ripley at stats.ox.ac.uk
Thu Jan 3 08:12:39 CET 2008
On Wed, 2 Jan 2008, Daniel Malter wrote:
> Hi, I am fitting two models, a generalized linear model and a generalized
> additive model, to the same data. The R-Help tells that "A generalized
> additive model (GAM) is a generalized linear model (GLM) in which the linear
> predictor is given by a user specified sum of smooth functions of the
> covariates plus a conventional parametric component of the linear
> predictor." I am fitting the GAM without smooth functions and would have
> expected the parameter estimates to be equal to the GLM.
>
> I am fitting the following model:
>
> reg.glm=glm(YES~factor(RoundStart)+DEP+SPD+S.S+factor(LOST),family=binomial(
> link="probit"))
> reg.gam=gam(YES~factor(RoundStart)+DEP+SPD+S.S+factor(LOST),family=binomial(
> link="probit"))
>
> DEP, SPD, S.S, and LOST are invariant across the observations within the
> same RoundStart. Therefore, I would expect to get NAs for these parameter
> estimates.
So your design matrix is rank-deficient and there is an identifiability
problem.
> I get NAs in GLM, but I get estimates in GAM. Can anyone explain
> why that is?
Because there is more than one way to handle rank deficiency. There are
two different 'gam' functions in contributed packages for R (and none in R
itself), so we need more details: see the footer of this message.
In glm() the NA estimates are treated as zero for computing predictions.
> Thanks much,
> Daniel
>
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list