Dear all,

I have encountered a weird behaviour in R 
survival package which seems to me to be a bug. 

The weird behaviour happens when I am using 
100 variables in the ridge function when calling 
coxph with following formula Surv(time = futime,
event = fustat, type = "right") ~ ridge(X1, X2, 
X3, X4, X5, X6, X7, X8, X9, X10, X11, X12, X13, 
X14, X15, X16, X17, X18, X19, X20, X21, X22, X23,
X24, X25, X26, X27, X28, X29, X30, X31, X32, X33,
X34, X35, X36, X37, X38, X39, X40, X41, X42, X43, 
X44, X45, X46, X47, X48, X49, X50, X51, X52, X53, 
X54, X55, X56, X57, X58, X59, X60, X61, X62, X63, 
X64, X65, X66, X67, X68, X69, X70, X71, X72, X73,
X74, X75, X76, X77, X78, X79, X80, X81, X82, X83,
X84, X85, X86, X87, X88, X89, X90, X91, X92, X93, 
X94, X95, X96, X97, X98, X99, X100, 
theta = lambda, scale = FALSE)

and get the error message 
Error in model.frame.default(formula = form,
data = sdf) : invalid variable names 
Calls: coxph -> eval -> eval ->
model.frame -> model.frame.default Execution halted

I am using R 2.8.0 and the latest version of 
the survival package 2.35-4.

Here is how you can re-create the error message

> library(survival)
Loading required package: splines
> x<-as.data.frame(matrix(rnorm(100*500),ncol=100))
> x$y<-1:500
> x$status<-1
> lambda<-1.0
> ff<-as.formula(paste("Surv(y,status)~ridge(",
    paste(names(x)[1:100],collapse=","), 
    ",theta = lambda, scale = FALSE)"))
> coxph(ff,x)
Error in model.frame.default(formula = ff, 
data = x) : invalid variable names
> print (ff)
Surv(y, status) ~ ridge(V1, V2, V3, V4, V5, V6, V7, V8, V9, V10,
    V11, V12, V13, V14, V15, V16, V17, V18, V19, V20, V21, V22,
    V23, V24, V25, V26, V27, V28, V29, V30, V31, V32, V33, V34,
    V35, V36, V37, V38, V39, V40, V41, V42, V43, V44, V45, V46,
    V47, V48, V49, V50, V51, V52, V53, V54, V55, V56, V57, V58,
    V59, V60, V61, V62, V63, V64, V65, V66, V67, V68, V69, V70,
    V71, V72, V73, V74, V75, V76, V77, V78, V79, V80, V81, V82,
    V83, V84, V85, V86, V87, V88, V89, V90, V91, V92, V93, V94,
    V95, V96, V97, V98, V99, V100, theta = lambda, scale = FALSE)

Also I have found that the code breaks with number of variables greater
than 97. For 97 and less it works fine. I have found that it breaks at the
following line of the coxph function

    if (is.R())
        m <- eval(temp, parent.frame())

I have been trying to understand why it breaks there and have not
progressed much so far.

With kind regards
DK


_________________________________________________________________

icons.

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to