[R] survit function and cox model with frailty

Thomas W Blackwell tblackw at umich.edu
Tue May 20 15:52:56 CEST 2003


Giacomo  -

I'm stumped.  Again, I have never had occasion to use the
survival package myself and I am just looking for syntax
irregularities in the code you show.  The new error message
"Error in x2 %*% coef" is suggestive.  Do take a look at
coef(model1) to see if there is something irregular there.
You might print temp out to the screen to see that x2 has
the exepcted value.  Could the original data's data frame
have changed between the time  model1  was created and the
time  survfit() is run on it ?

(I've had SO much difficulty in the past with alternating
commas and decimal points that I would have defined x2 as
  x2 = rep(1.5, 5).)

I reassure you that you CAN get to the bottom of this.
I think you're making progress.  One step going forward
might be to look at  help("model.frame"), since that's
what causes the initial error message, and think about
how the arguments get matched in  survfit().

Aaaah.  Here's one more thing you could try.  Give the
new data frame of dimensions 5 x 6 some other name than
"temp" and try again.  I see that the variable name "temp"
is already used in survfit() for something else.  Again,
this is just a guess.  Unfortunately, the package code
is very complex.

-  tom blackwell  -  u michigan medical school  -  ann arbor  -


On Mon, 19 May 2003 gc4 at duke.edu wrote:

>
> ... However, I obtain the following error message:
>
> fit2 <- survfit(model1, newdata=temp, individual=TRUE)
> Error in x2 %*% coef : non-conformable arguments
>
> 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
>
> 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