[R] Problem with R 2.9.0 vs. R2.8.1 with either "survival" package or "predict" function
Dimitri Liakhovitski
ld7631 at gmail.com
Mon Apr 27 18:59:37 CEST 2009
Just wanted to alert everyone regarding a problem that I only
experience with R2.9.0 and not with R2.8.1 when I run both using
exactly the same script and the same data.
Here is what I do with my data "MyData", 2 predictors (V1 and V2) and
my survival DV "Depvar":
library(survival)
model<-coxph(Depvar~V1:V2+strata(ID),data=MyData,na.action=na.omit,method="breslow")
When I look at summary(model), the very end of it looks like this in R2.8.1:
Rsquare= 0.067 (max possible= 0.792 )
Likelihood ratio test= 169 on 24 df, p=0
Wald test = 144 on 24 df, p=0
Score (logrank) test = 164 on 24 df, p=0
When I look at summary(model), the very end of it looks like this in
R2.9.0 (looks the same to me):
Rsquare= 0.067 (max possible= 0.792 )
Likelihood ratio test= 168.8 on 24 df, p=0
Wald test = 144.1 on 24 df, p=0
Score (logrank) test = 164.0 on 24 df, p=0
Then, I run this line:
utilities<-predict(model,newdata=expand.grid(V1=factor(1:5),V2=factor(1:5)))
This line runs fine in R2.8.1 and gives me a vector of utilities.
But when I run it in R2.9.0, I get:
Error in model.frame.default(Terms2, newdata, xlev = object$xlevels) :
variable lengths differ (found for 'V1')
In addition: Warning message:
'newdata' had 25 rows but variable(s) found have 2415 rows
I prefer not to get into the debugging of that whole thing. But
thought that someone knowledgeable might get an idea about what might
be wrong in the latest R version.
--
Dimitri Liakhovitski
MarketTools, Inc.
Dimitri.Liakhovitski at markettools.com
More information about the R-help
mailing list