El 14/10/2008, a las 18:05, Martin Maechler escribió:

"AMT" == Arnau Mir Torres <[EMAIL PROTECTED]>
   on Tue, 14 Oct 2008 17:13:01 +0200 writes:
"AMT" == Arnau Mir Torres <[EMAIL PROTECTED]>
   on Tue, 14 Oct 2008 17:13:01 +0200 writes:

   AMT> Hello.

AMT> I need to know how can R compute AIC when I study a regression model?
   AMT> For example, if I use these data:
   AMT> growth tannin
   AMT> 1     12      0
   AMT> 2     10      1
   AMT> 3      8      2
   AMT> 4     11      3
   AMT> 5      6      4
   AMT> 6      7      5
   AMT> 7      2      6
   AMT> 8      3      7
   AMT> 9      3      8
   AMT> and I do
   AMT> model <- lm (growth ~ tannin)
   AMT> AIC(model)

   AMT> R responses:
   AMT> 38.75990

   AMT> I know the following formula to compute AIC:
   AMT> AIC= -2*log-likelihood + 2*(p+1)

   AMT> In my example, it would be:
   AMT> AIC=-2*log-likelihood + 2*2
   AMT> but I don't know how R computes log-likelihood:

   AMT> logLik(model)
   AMT> 'log Lik.' -16.37995 (df=3)

and so?

What is the formula to compute logLik? I don't know how to compute "by hand" logLik(model) and obtain -16.37995.


Arnau.


Hint:     Your only problem is that your 'p' is wrongly off by one.
2nd Hint: sigma is a parameter, too


------------------------------------------------------------
Arnau Mir Torres
Edifici A. Turmeda
Campus UIB
Ctra. Valldemossa, km. 7,5
07122 Palma de Mca.
tel: (+34) 971172987
fax: (+34) 971173003
email: [EMAIL PROTECTED]
URL: http://dmi.uib.es/~arnau
------------------------------------------------------------








______________________________________________
R-help@r-project.org mailing list
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.

Reply via email to