The examples you quote are not gams: using glm() would give a fit from
which the deviance can be used to compare AICs (up to an additive
constant).
In general AIC is not even defined for a real GAM (a gam() fit including
s() or lo() terms), for AIC presumes maximum-likelihood fitting (amongst
other things), and gam() uses an approximation to a penalized fit.
On Sat, 30 Aug 2003, Poh Siew Hua wrote:
> Hello,
> I keep across a posting by someone on the internet. I have the same
> problem too when I use S-plus 6.0/6.1 on a windows environment. I am
> trying to find the AIC for poisson regression. May I know what
> commands/menu should I use to commute the AIC for my models?
>
> Thanks so much if you could help me!
>
>
> Rgds,
> siewhua
>
>
>
>
>
>
>
>
> AIC in gam()
>
> from [ananthcv] [Bookmark Link][Original]
> To: s-news@lists.biostat.wustl.edu
> <mailto:s-news%40lists.biostat.wustl.edu>
> Subject: AIC in gam()
> From: ananthcv <ananthcv@epi.umdnj.edu
> <mailto:ananthcv%40epi.umdnj.edu> >
> Date: Mon, 7 Apr 2003 15:21:47 -0400 (EDT)
> Reply-to: ananthcv <ananthcv@epi.umdnj.edu
> <mailto:ananthcv%40epi.umdnj.edu> >
> I need some help in obtaining the AIC statistics from comparing two logistic
> regression models using gam(). I am running Splus 6.0 on the UNIX (Solaris
> 8).
> My models are
>
> model1 <- gam(y ~ poly(x1,2), binomial, weight=wt)
> model2 <- gam(y ~ x1 , binomial, weight=wt)
>
> when I run AIC(model1, model2), I get the following error:
>
> Problem in logLik.lm(...X.sub.i....): Length of (qr) (variable 4) is 1 !=
> length
> of others (158335)
>
> I can't seem to figure out the error, and what I need to do to correct it.
> running summary() on each of the models do work. Any help will be
> appreciated.
> Thanks.
>
> regards,
> cande ananth
> ananthcv@epi.umdnj.edu
>
>
>
> --------------------------------------------------------------------This
> message was distributed by s-news@lists.biostat.wustl.edu. Tounsubscribe
> send e-mail to s-news-request@lists.biostat.wustl.edu withthe BODY of the
> message: unsubscribe s-news
>
>
--
Brian D. Ripley, ripley@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
|