Learn R Programming

BGPhazard (version 1.2.3)

CGaMRes: Markov Gamma Model with Covariates

Description

Posterior inference for the Bayesian non-parametric Markov gamma model with covariates in survival analysis.

Usage

CGaMRes(data, type.t = 1, K = 5, alpha = rep(0.001, K.aux), 
beta = rep(1e-04, K.aux), c.r = rep(0, K.aux - 1), type.c = 4, 
epsilon = 1, iterations = 1000, burn.in = floor(iterations * 0.2), 
thinning = TRUE, thpar = 3, printtime = TRUE)

Arguments

data

Numeric matrix. Contains failure times in the first column, status indicator in the second, and, from the third to the last column, the varying covariate(s).

type.t

Integer. 1=computes uniformly-dense intervals; 2=unitary length intervals and 3=same length intervals.

K

Integer. Partition length for the hazard function if type.t=1 or type.t=3.

alpha

Nonnegative entry vector. Small entries are recommended in order to specify a non-informative prior distribution.

beta

Nonnegative entry vector. Small entries are recommended in order to specify a non-informative prior distribution.

c.r

Correlation vector. Its entries must be nonnegative integers.

type.c

1=defines c.r as a zero-entry vector; 2=lets the user define c.r feeely; 3=defines c.r by computing an exponential distribution with mean 1; 4=defines c.r by computing an exponential distribution with mean epsilon which has assigned a Ga(0.01, 0.01) distribution.

epsilon

Double. Mean of the exponential distribution assigned to c.r when type.c = 3. When type.c = 4, epsilon is assigned a Ga(0.01,0.01) distribution.

iterations

Integer. Number of iterations including the burn.in to be computed by the model.

burn.in

Integer. Length of the burn-in period for the Markov chain.

thinning

Logical. TRUE thins the Markov chain to reduce autocorrelation.

thpar

Integer. Factor by which the chain will be thinned if thinning=TRUE.

printtime

Logical. If TRUE, prints out the execution time.

Value

times

Numeric vector. Failure times.

delta

Numeric vector. Status indicator.

covar

Numeric matrix. Matrix of covariates.

type.t

Integer.

tao

Numeric vector. Partition for hazard function's support.

K

Integer. Partition length.

t.unc

Numeric vector. Uncensored failure times sorted ascendingly.

iterations

Integer.

summary

Numeric matrix. Contains the resulting Markov chain for lambda, u, c.r, epsilon (if applicable) and the coefficients.

S

Numeric matrix. Survival estimates for each state of the chain.

H

Numeric matrix. Cummulative hazard rate estimates for each state of the chain.

p

Integer. Number of covariates for the data set given.

Details

Computes the Gibbs sampler given by the full conditional distributions of h, lambda and theta (Nieto-Barajas, 2003) and arranges the resulting Markov chain into a matrix which can be used to obtain posterior summaries. Prior distributions for the coefficients (theta) are assumend independent normals with zero mean and standard deviation 10.

References

- Nieto-Barajas, L. E. (2003). Discrete time Markov gamma processes and time dependent covariates in survival analysis. Bulletin of the International Statistical Institute 54th Session. Berlin. (CD-ROM).

- Nieto-Barajas, L. E. & Walker, S. G. (2002). Markov beta and gamma processes for modelling hazard rates. Scandinavian Journal of Statistics 29: 413-424.

See Also

PlotTheta, CGaPlotDiag, CGaPloth

Examples

Run this code
# NOT RUN {
## Simulations may be time intensive. Be patient.

## Example 1
#  data(leukemiaFZ)
#  leukemia1 <- leukemiaFZ
#  leukemia1$wbc <- log(leukemiaFZ$wbc)
#  CGEX1 <- CGaMRes(data = leukemia1, K = 10, iterations = 10000, thpar = 10)

## Example 2. Refer to "Cox-gamma model example" section in package vignette for details.
#  SampWeibull <- function(n, a = 10, b = 1, beta = c(1, 1)) {
#    M <- matrix(0, ncol = 7, nrow = n)
#    for(i in 1:n){
#      M[i, 1] <- i
#      M[i, 2] <- x1 <- runif(1)
#      M[i, 3] <- x2 <- runif(1)
#      M[i, 4] <- rweibull(1, shape = b, 
#                          scale = 1 / (a * exp(cbind(x1, x2) %*% beta)))
#      M[i, 5] <- rexp(1)
#      M[i, 6] <- M[i, 4] > M[i, 5]
#      M[i, 7] <- min(M[i, 4], M[i, 5])
#      }
#    colnames(M) <- c("i", "x_i1", "x_i2", "t_i", "c_i", "delta", "min{c_i, d_i}")
#    return(M)
#  }
#  dat <- SampWeibull(100, 0.1, 1, c(1, 1))
#  dat <- cbind(dat[, c(4, 6)], dat[, c(2, 3)])
#  CG <- CGaMRes(dat, K = 10, iterations = 3000, thpar = 10)
# }

Run the code above in your browser using DataLab