[R] enquiry

ah06981 at studbocconi.it ah06981 at studbocconi.it
Wed Sep 12 12:51:41 CEST 2007


Dear R-help,

I am trying to estimate a Cox model with nested effects basing on the 
minimization of the overall AIC; I have two frailties terms, both gamma 
distributed.  There is a error message (theta2 argument  misses) and I 
don?t understand why. I would like to know what I have wrong. Thank you 
very much for your time.


fitM7 <- coxph(Surv(lifespan,censured) ~ south + frailty(id, 
dist='gamma')+ frailty(mob, dist='gamma'), data= usa)


tempfun <- function(theta1, theta2) {

fit <- coxph(Surv(lifespan,censured) ~ south + frailty(id, 
dist='gamma', sparse= TRUE, theta=theta1)+ frailty(mob, dist='gamma', 
sparse =TRUE, theta=theta2), data=usa)
aic <- (fit$loglik[2] - fit$loglik[1]) - sum(fit$df)
return(2*aic)
}
nlminb(c(theta1=3.2,theta2=.2), tempfun)




Error in (get(temp))(x, ...) : argument "theta2" is missing, with no default

Best,
Silvia



More information about the R-help mailing list