# generate some survival data
set.seed(204542)
p = 20
n = 200
logHR.true <- c(rep(4, 10), rep(0, (p-10)))
CovX<-matrix(0,p,p)
for(i in 1:10){
for(j in 1:10){
CovX[i,j] <- 0.3^abs(i-j)
}
}
diag(CovX) <- 1
data <- apply(rmvnorm(n, sigma=CovX, method="chol"), 2, scale)
pred <- as.vector(exp(rowSums(scale(data, center = FALSE, scale = 1/logHR.true))))
t <- rexp(n, rate = pred)
cen <- runif(n, 0, 8)
tcen <- pmin(t, cen)
di <- as.numeric(t <= cen)
n <- dim(data)[1]
p <- dim(data)[2]
Y <- data.frame(cbind(tcen, di))
colnames(Y) <- c("time", "event")
grpInx <- 1:p
K <- length(unique(grpInx))
############################
hyperParams <- list(nu0=3, sigSq0=1, alpha0=0, h0=10^6, rLam=0.5, deltaLam=2)
############################
startValues <- list(alpha=0.1, beta=rep(1,p), sigSq=1, tauSq=rep(0.4,p), lambdaSq=5,
w=log(tcen))
############################
mcmc <- list(numReps=100, thin=1, burninPerc=0.5)
############################
fit <- aftGL(Y, data, grpInx, hyperParams, startValues, mcmc)
if (FALSE) {
vs <- VS(fit, X=data)
}
Run the code above in your browser using DataLab