[R] Is AIC in glm right?
Hiroto Miyoshi
h_m_ at po.harenet.ne.jp
Thu Aug 23 14:51:59 CEST 2001
> Could anyone help me?
> I am doing a regression analysis using glm.
> and the glm function gives AIC at the end of
> the output. However, the AIC value the function
> gives does not seem right. The details of my
> analysis goes as follows.
>
> > x
> y x z
> 1 325 2 1
> 2 275 4 0
> 3 350 4 1
> 4 400 6 1
> 5 325 7 0
> 6 425 8 1
> 7 375 10 0
> 8 475 10 1
> 9 400 12 0
> 10 575 12 1
> 11 425 14 0
> 12 450 16 0
> 13 700 17 1
> 14 525 18 0
> 15 600 20 0
> 16 750 20 1
> 17 650 22 0
> 18 775 23 1
> 19 675 24 0
> 20 825 26 1
>
> > glm(x$y~x$x+x$z)
>
> Call: glm(formula = x$y ~ x$x + x$z)
>
> Coefficients:
> (Intercept) x$x x$z
> 148.82 21.85 131.51
>
> Degrees of Freedom: 19 Total (i.e. Null); 17 Residual
> Null Deviance: 533000
> Residual Deviance: 13350 AIC: 194.8
>
> > a<-residuals(glm(x$y~x$x+x$z))
> > sum(a*a)
> [1] 13347.96
> >
>
> Now, since sum of squares of residuals of the regression
> is 133347.96, should AIC be 136.068,
> i.e. 20*ln(13348/20)+2*3?
>
> Could someone help me?
> Thank you.
> ---------------------------
> Hiroto Miyoshi (三好弘人)
> h_m_ at po.harenet.ne.jp
>
>
>
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list