Learn R Programming

intsurvbin (version 0.0.4)

aftprobiths: Horseshoe shrinkage prior in integrated survival and binary regression

Description

This function provides the implementation of integrated survival and binary high dimensiona regression utilizing Horseshoe prior on the paramters

Usage

aftprobiths(ct, z, X, burn = 1000, nmc = 5000, thin = 1,
  alpha = 0.05, Xtest = NULL, cttest = NULL, ztest = NULL)

Arguments

ct

survival response, a \(n*2\) matrix with first column as response and second column as right censored indicator, 1 is event time and 0 is right censored.

z

binary response, a \(n*1\) vector with numeric values 0 or 1.

X

Matrix of covariates, dimension \(n*p\).

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.

ztest

test binary response.

Value

Beta.sHat

Posterior mean of \(\beta\) for survival model, a \(p\) by 1 vector.

Beta.bHat

Posterior mean of \(\beta\) for binary model, a \(p\) by 1 vector.

LeftCI.s

The left bounds of the credible intervals for Beta.sHat.

RightCI.s

The right bounds of the credible intervals for Beta.sHat.

LeftCI.b

The left bounds of the credible intervals for Beta.bHat.

RightCI.b

The right bounds of the credible intervals for Beta.bHat.

Beta.sMedian

Posterior median of \(beta\) for survival model, a \(p\) by 1 vector.

Beta.bMedian

Posterior median of \(beta\) for binary model, a \(p\) by 1 vector.

SigmaHat

Posterior mean of variance covariance matrix.

LambdaHat

Posterior mean of \(\lambda\), a \(p*1\) vector.

TauHat

Posterior mean of \(\tau\), a \(2*1\) vector.

Beta.sSamples

Posterior samples of \(\beta\) for survival model.

Beta.bSamples

Posterior samples of \(\beta\) for binary model.

LambdaSamples

Posterior samples of \(\lambda\).

TauSamples

Posterior samples of \(\tau\).

SigmaSamples

Posterior samples of variance covariance matrix.

DIC.s

DIC for survival model.

DIC.b

DIC for binary model.

SurvivalHat

Predictive survival probability.

LogTimeHat

Predictive log time.

References

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).

Examples

Run this code
# NOT RUN {
burnin <- 50
nmc    <- 150
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

zmean <- x %*% beta.t
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
z <- ifelse((y[, 2] + zmean) > 0, 1, 0)
X <- scale(as.matrix(x))  # standarization

z <- as.numeric(as.matrix(c(z)))
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
ztrain <- z[1:ntrain]
cttrain <- ct[1:ntrain, ]
Xtrain  <- X[1:ntrain, ]

# Test set
ztest <- z[(ntrain + 1):n]
cttest <- ct[(ntrain + 1):n, ]
Xtest  <- X[(ntrain + 1):n, ]

posterior.fit.joint <- aftprobiths(ct = cttrain, z = ztrain, X = Xtrain,
                                   burn = burnin, nmc = nmc, thin = thin,
                                   Xtest = Xtest, cttest = cttest, ztest = ztest)
                             
posterior.fit.joint$Beta.sHat

# }

Run the code above in your browser using DataLab