# NOT RUN {
burnin <- 500 # number of burnin
nmc <- 1000 # number of Markov Chain samples
y.sd <- 1 # standard deviation of the data
p <- 80 # number of covariates
n <- 40 # number of samples
beta <- as.vector(smoothmest::rdoublex(p)) # from double exponential distribution
x <- mvtnorm::rmvnorm(n, mean = rep(0, p)) # from multivariate normal distribution
y.mu <- x %*% beta # mean of the data
y <- as.numeric(stats::rnorm(n, mean = y.mu, sd = y.sd)) # from normal distribution
T <- exp(y) # AFT model
C <- rgamma(n, shape = 1.75, scale = 3) # censoring time
time <- pmin(T, C) # observed time is min of censored and true
status = time == T # set to 1 if event is observed
ct <- as.matrix(cbind(time = time, status = status)) # censored time
posterior.fit <- hsaft(ct, x, method.tau = "truncatedCauchy", method.sigma = "Jeffreys",
burn = burnin, nmc = nmc)
summary(posterior.fit$BetaHat)
# }
Run the code above in your browser using DataLab