[R] survit function and cox model with frailty

gc4@duke.edu gc4 at duke.edu
Mon May 19 21:40:00 CEST 2003


Hi:

I have a question about the use of the survfit function after the
estimation of a cox proportional hazard model with a frailty term. My goal
is to estimate expected survival probabilities while controlling for the
group-specific frailty term.

First, I estimate a model of the following form:


model1 <- coxph(Surv(t0, t, d) ~ x1 + x2 + frailty(id), na.action=na.exclude,
                data=My.data)


Then, I prepare a data frame:


temp <- data.frame(t0=c(0,365,730,1095,1460),
                   t=c(365,730,1095,1460,3000),
                   d=c(0,0,0,0,0),
                   x1=c(0,0,0,0,0),
                   x2=c(1.5,1.5,1.5,1.5,1.5))


I think I would need to enter a statement with respect to the frailty
term, but I don't know how.

Indeed, when I use the survit function with temp data frame, I get an
error message:

> fit2 <- survfit(model1, newdata=temp, individual=TRUE)
Error in model.frame(formula, rownames, variables, varnames, extras,
extranames,  :
        variable lengths differ


Thank you very much,
giacomo




More information about the R-help mailing list