>>>>> "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?  

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

______________________________________________
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