Hi everyone,
I'm working on survival models where a random effect is added (frailty
models).
I would like to extract the Akaike's information criterion (AIC) to
determine the best model.
Is the following function correct? Can I extract the number of
parameters
estimated by the following code: 2*ncol(cox.obj$var)?
coxAIC <- function(cox.obj){
-2 * (cox.obj$loglik[2] - ncol(cox.obj$var))
}
Example :
I've got three fixed effects and one random effect (village) :
nkolov.coxG <- coxph(Surv(duree, censure) ~ verm
+ portee
+ vacc
+
frailty(village),singular.ok=T,
eps = 0.01, nkolov3)
coxAIC(nkolov.coxG)
The details of the AIC calculation is :
> nkolov.coxG$loglik[2]
[1] -1915.367
> ncol(nkolov.coxG$var)
[1] 3
> coxAIC(nkolov.coxG)
[1] 3836.734
Is there a better way to get the AIC value?
Thanks a lot for your help.
--
Arnaud Moisan
ISRA-LNERV / CIRAD-EMVT
BP 2057
Dakar Hann
Senegal
Tel: (00 221) 832 49 02 (bureau)
Email : moisan@telecomplus.sn
-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news
|