[R] help about how can R compute AIC?
Arnau Mir Torres
arnau.mir at uib.es
Tue Oct 14 17:13:01 CEST 2008
Hello.
I need to know how can R compute AIC when I study a regression model?
For example, if I use these data:
growth tannin
1 12 0
2 10 1
3 8 2
4 11 3
5 6 4
6 7 5
7 2 6
8 3 7
9 3 8
and I do
model <- lm (growth ~ tannin)
AIC(model)
R responses:
38.75990
I know the following formula to compute AIC:
AIC= -2*log-likelihood + 2*(p+1)
In my example, it would be:
AIC=-2*log-likelihood + 2*2
but I don't know how R computes log-likelihood:
logLik(model)
'log Lik.' -16.37995 (df=3)
Thanks,
Arnau.
------------------------------------------------------------
Arnau Mir Torres
Edifici A. Turmeda
Campus UIB
Ctra. Valldemossa, km. 7,5
07122 Palma de Mca.
tel: (+34) 971172987
fax: (+34) 971173003
email: arnau.mir at uib.es
URL: http://dmi.uib.es/~arnau
More information about the R-help
mailing list