M<-500
K<-100
n<-2
N<-n*K
alfa<-0.25
delta<-0.2
beta<-0
stoptime<-2
condest<-matrix(0,M,5)
condsc<-matrix(0,M,2)
for(i in 1:M){
print(i)
x<-Simulationposstgl(K,alfa,beta)
clid<-as.vector(t(matrix(rep((1:K),2),K,2)))
time<-as.vector(t(x[,,1]))
status<-as.vector(t(x[,,2]))
z<-as.vector(t(x[,,3]))
s.tider<-sort(time[status[]==1])
k<-length(s.tider)
condest[i,5]<-coxph(Surv(time,status)~z)$coef
condest[i,4]<-coxph(Surv(time,status)~z+strata(clid))$coef
condest[i,3]<-condest[i,5]/condest[i,4]
beta.I<-condest[i,5]
Lam<-cumsum(breslow.I(beta.I))
delta<-(s.tider[exp(-Lam)<=(1-0.05)])[1]
print(delta)
res<-c(0,0)
V<-1:4
U.c.res<-U.c(beta/alfa,alfa)
condsc[i,]<-as.vector(U.c.res[[4]])
condest[i,(1:2)]<-as.vector(NewR(beta/alfa,alfa))
print(condest[i,])
print(condsc[i,])
}
这是一段R程序,但是不知道为什么实现不了,还请高手帮忙解决,不胜感激



雷达卡


京公网安备 11010802022788号







