[R] survit function and cox model with frailty

gc4@duke.edu gc4 at duke.edu
Tue May 20 03:55:06 CEST 2003


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:

> fit2 <- survfit(model3, newdata=temp, individual=TRUE)
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:

> Giacomo  -
>
> Here's just a guess, since I have no experience with this.
> Try adding a sixth variable to the data frame "temp", a
> variable named "id" with value c(1,1,1,1,1).  Maybe that
> will do it ?   This is consistent with your intention in
> setting individual=TRUE, and it will give the frailty()
> term that's already in the model something to work with.
>
> -  tom blackwell  -  u michigan medical school  -  ann arbor  -
>




More information about the R-help mailing list