3# ltx5151 set.seed(10101)
N=1000;p=30
nzc=p/3
x=matrix(rnorm(N*p),N,p)
beta=rnorm(nzc)
fx=x[,seq(nzc)]%*%beta/3
hx=exp(fx)
ty=rexp(N,hx)
tcens=rbinom(n=N,prob=.3,size=1)# censoring indicator
y=cbind(time=ty,status=1-tcens) # y=Surv(ty,1-tcens) with library(survival)
fit=glmnet(x,y,family="cox")
plot(fit)
这是自带的例子,可以运行,一切正常。
我套用自己的数据,是模拟数据
y=Surv(t,SS)
y
x<-matrix(X,100,1000)
x
cv.fit <- cv.glmnet(x,y, family = "cox", maxit = 1000)
fit<-glmnet(x,y,family = "cox", maxit = 1000)
plot(cv.fit)
plot(fit)
运行之后出现上述错误提示!!求解啊!!