Skip to content
Prev 32240 / 398506 Next

survit function and cox model with frailty

Hi:

I have followed through Thomas' suggestions, but unfortunately, to no
avail. I added a statement identifying the id group variable to the temp
data frame which I feed into the survfit function.

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),
                   id=c(1,1,1,1,1))

However, I obtain the following error message:

fit2 <- survfit(model1, newdata=temp, individual=TRUE)
Error in x2 %*% coef : non-conformable arguments

The survfit function seems to be looking for a coefficient for the frailty
term, which, of course, is not there given that:
  h(t)=h0(t)*a*exp(Xb), where a is the frailty term.

I also tried to add a "frail(id)"=c(1,1,1,1,1) line to the statement
that creates the temp data frame. But, again, I obtain the following error
message:
Error in model.frame(formula, rownames, variables, varnames, extras,
extranames,  :
        variable lengths differ

Thank you very much for any suggestions. Thanks, in particular, to Thomas.
giacomo
On Mon, 19 May 2003, Thomas W Blackwell wrote: