Description Usage Arguments Details Value References Examples

This function employs the algorithm provided by van der Pas et. al. (2016) for log normal Accelerated Failure Rate (AFT) model to fit survival regression. The censored observations are updated according to the data augmentation of approach of Tanner and Wong (1984).

1 2 3 4 |

`ct` |
survival response, a |

`X` |
Matrix of covariates, dimension |

`method.tau` |
Method for handling |

`tau` |
Use this argument to pass the (estimated) value of |

`method.sigma` |
Select "Jeffreys" for full Bayes with Jeffrey's prior on the error
variance |

`Sigma2` |
A fixed value for the error variance |

`burn` |
Number of burn-in MCMC samples. Default is 1000. |

`nmc` |
Number of posterior draws to be saved. Default is 5000. |

`thin` |
Thinning parameter of the chain. Default is 1 (no thinning). |

`alpha` |
Level for the credible intervals. For example, alpha = 0.05 results in 95% credible intervals. |

`Xtest` |
test design matrix. |

`cttest` |
test survival response. |

The model is:
*t_i* is response,
*c_i* is censored time,
*t_i^* = \min_(t_i, c_i)* is observed time,
*w_i* is censored data, so *w_i = \log t_i^** if *t_i* is event time and
*w_i = \log t_i^** if *t_i* is right censored
*\log t_i=Xβ+ε, ε \sim N(0,σ^2)*.

`SurvivalHat` |
Predictive survival probability |

`LogTimeHat` |
Predictive log time |

`Beta.sHat` |
Posterior mean of Beta, a |

`LeftCI.s` |
The left bounds of the credible intervals |

`RightCI.s` |
The right bounds of the credible intervals |

`Beta.sMedian` |
Posterior median of Beta, a |

`LambdaHat` |
Posterior samples of |

`Sigma2Hat` |
Posterior mean of error variance |

`TauHat` |
Posterior mean of global scale parameter tau, a positive scalar |

`Beta.sSamples` |
Posterior samples of |

`TauSamples` |
Posterior samples of |

`Sigma2Samples` |
Posterior samples of Sigma2 |

Maity, A. K., Carroll, R. J., and Mallick, B. K. (2019) "Integration of Survival and Binary Data for Variable Selection and Prediction: A Bayesian Approach", Journal of the Royal Statistical Society: Series C (Applied Statistics).

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | ```
burnin <- 500
nmc <- 500
thin <- 1
y.sd <- 1 # standard deviation of the response
p <- 100 # number of predictors
ntrain <- 100 # training size
ntest <- 50 # test size
n <- ntest + ntrain # sample size
q <- 10 # number of true predictos
beta.t <- c(sample(x = c(1, -1), size = q, replace = TRUE), rep(0, p - q)) # randomly assign sign
Sigma <- matrix(0.9, nrow = p, ncol = p)
for(j in 1:p)
{
Sigma[j, j] <- 1
}
x <- mvtnorm::rmvnorm(n, mean = rep(0, p), sigma = Sigma) # correlated design matrix
tmean <- x %*% beta.t
yCorr <- 0.5
yCov <- matrix(c(1, yCorr, yCorr, 1), nrow = 2)
y <- mvtnorm::rmvnorm(n, sigma = yCov)
t <- y[, 1] + tmean
X <- scale(as.matrix(x)) # standarization
t <- as.numeric(as.matrix(c(t)))
T <- exp(t) # AFT model
C <- rgamma(n, shape = 1.75, scale = 3) # 42% 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
# Training set
cttrain <- ct[1:ntrain, ]
Xtrain <- X[1:ntrain, ]
# Test set
cttest <- ct[(ntrain + 1):n, ]
Xtest <- X[(ntrain + 1):n, ]
posterior.fit.aft <- afths(ct = cttrain, X = Xtrain, method.tau = "halfCauchy",
method.sigma = "Jeffreys", burn = burnin, nmc = nmc, thin = 1,
Xtest = Xtest, cttest = cttest)
posterior.fit.aft$Beta.sHat
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.