[R] Does AIC() applied to a nls() object use the correctnumber of estimated parameters?
Peter.Caley@csiro.au
Peter.Caley at csiro.au
Fri Jul 16 05:57:03 CEST 2004
Thanks Adaikalavan, however the problem remains.
Considering AIC() as applied to the linear model in AIC() help
documentation:
> data(swiss)
> lm1 <- lm(Fertility ~ . , data = swiss)
> AIC(lm1)
[1] 326.0716
Clearly this includes the estimation of the residual standard error as
an estimated parameter, as this gives the correct score:
> -2*logLik(lm1) + 2*(length(coef(lm1))+1)
[1] 326.0716
attr(,"nall")
[1] 47
attr(,"nobs")
[1] 47
attr(,"df")
[1] 7
attr(,"class")
[1] "logLik"
I thought the same would have held for nls() objects.
> -----Original Message-----
> From: Adaikalavan Ramasamy [mailto:ramasamy at cancer.org.uk]
> Sent: Friday, 16 July 2004 1:14 PM
> To: Caley, Peter (Entomology, Black Mountain)
> Cc: R-help
> Subject: Re: [R] Does AIC() applied to a nls() object use the
> correctnumber of estimated parameters?
>
>
> I do not know anything about nls(), so apologies if I get it
> completely wrong. help("AIC") says that AIC is defined to be
> -2*log-likelihood + k*npar; where k = 2 by default.
>
> I think you calculated -2*log-likelihood + k*(npar + 1)
> instead. Does this help ?
>
> On Fri, 2004-07-16 at 03:50, Peter.Caley at csiro.au wrote:
> > I'm wondering whether AIC scores extracted from nls() objects using
> > AIC() are based on the correct number of estimated parameters.
> >
> > Using the example under nls() documentation:
> >
> > > data( DNase )
> > > DNase1 <- DNase[ DNase$Run == 1, ]
> > > ## using a selfStart model
> > > fm1DNase1 <- nls( density ~ SSlogis( log(conc), Asym,
> xmid, scal ),
> > DNase1 )
> >
> > Using AIC() function:
> >
> > > AIC(fm1DNase1)
> > [1] -78.41642
> >
> > Using number of estimable coefficients (including residual error):
> >
> > > -2*logLik(fm1DNase1) + 2*(length(coef(fm1DNase1))+1)
> > [1] -76.41642
> > attr(,"df")
> > [1] 3
> > attr(,"nall")
> > [1] 16
> > attr(,"nobs")
> > [1] 16
> > attr(,"class")
> > [1] "logLik"
> >
> > Based on the difference in AIC of 2 between the two approaches, it
> > appears that when applied to a nls() object, AIC() doesn't
> include the
> > estimate of residual error in the number of estimated
> parameters ...
> > or is my understanding of nls() fitting confused.
> >
> > Any help appreciated.
> >
> > cheers
> >
> > Peter
> >
> >
> *********************************************************************
> > Dr Peter Caley
> > CSIRO Entomology
> > GPO Box 1700, Canberra,
> > ACT 2601
> > Email: peter.caley at csiro.au
> > Ph: +61 (0)2 6246 4076 Fax: +61 (0)2 6246 4000
> >
> > ______________________________________________
> > R-help at stat.math.ethz.ch mailing list
> > https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide!
> > http://www.R-project.org/posting-guide.html
> >
>
>
More information about the R-help
mailing list