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 ______________________________________________ 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.