[R] Obtaining fitted model information

Renaud Lancelot renaud.lancelot at cirad.fr
Sun Oct 31 20:16:46 CET 2004


Excuse me for the unfortunate cut and paste:

AICc_lm <- function(x){
   n <- length(resid(x))
   k <- attr(logLik(x), "df")    #### error in the previous message
   AIC(x) + 2 * k * (k + 1) / (n - k - 1)
   }

Best,

Renaud

John Fox a écrit :

> Dear Thomas,
> 
> To get the number of independent parameters in the lm object mod, you can
> use mod$rank, sum(!is.na(coef(mod)), or -- if there are no linear
> dependencies among the columns of the model matrix -- length(coef(mod)).
> 
> I hope this helps,
>  John
[snip]
-- 
Dr Renaud Lancelot, vétérinaire
C/0 Ambassade de France - SCAC
BP 834 Antananarivo 101 - Madagascar

e-mail: renaud.lancelot at cirad.fr
tel.:   +261 32 40 165 53 (cell)
         +261 20 22 665 36 ext. 225 (work)
         +261 20 22 494 37 (home)




More information about the R-help mailing list