# Some artificial data
set.seed(123)
n <- 50
mix1a<-rnorm(n,mean=0,sd=1); mix1b<-rnorm(n,mean=0.25,sd=sqrt(2)); alf1<-rbinom(n,1,0.2)
mix2a<-rnorm(n,mean=0,sd=1); mix2b<-rnorm(n,mean=0.25,sd=sqrt(2)); alf2<-rbinom(n,1,0.2)
mix1<-alf1*mix1a+(1-alf1)*mix1b; mix2<-alf2*mix2a+(1-alf2)*mix2b
x_cov<-array(c(mix1,mix2),dim=c(n,2)) # Matrix of covariate values
theta<-c(1,1.2)
Z<-colSums(theta*t(x_cov))
y<-Z+rnorm(n,sd=sqrt(abs(Z))) # True lifetimes
# Probability of being susceptible
p_fun <- function(x){ 0.55 * exp(1.5*x+1.5)/(1+exp(1.5*x+1.5)) + 0.001 }
for (i in 1:n){
w <- runif(1)
if (w > p_fun(Z[i])) y[i] <- Inf
}
c<-rexp(n,rate=0.98) # Censoring values
t<-pmin(y,c) # Observed times
d = 1 * (y<=c) # Uncensoring indicator
# \donttest{
suppressWarnings(sicure.v(x_cov, t, d))
# }
Run the code above in your browser using DataLab