MCMC_LLAP: MCMC algorithm for the log-Laplace model

View source: R/LogLaplace.R

MCMC_LLAPR Documentation

MCMC algorithm for the log-Laplace model

Description

Adaptive Metropolis-within-Gibbs algorithm with univariate Gaussian random walk proposals for the log-Laplace model

Usage

MCMC_LLAP(
  N,
  thin,
  burn,
  Time,
  Cens,
  X,
  Q = 1,
  beta0 = NULL,
  sigma20 = NULL,
  prior = 2,
  set = TRUE,
  eps_l = 0.5,
  eps_r = 0.5
)

Arguments

N

Total number of iterations. Must be a multiple of thin.

thin

Thinning period.

burn

Burn-in period. Must be a multiple of thin.

Time

Vector containing the survival times.

Cens

Censoring indication (1: observed, 0: right-censored).

X

Design matrix with dimensions n x k where n is the number of observations and k is the number of covariates (including the intercept).

Q

Update period for the λ_{i}’s

beta0

Starting values for β. If not provided, they will be randomly generated from a normal distribution.

sigma20

Starting value for σ^2. If not provided, it will be randomly generated from a gamma distribution.

prior

Indicator of prior (1: Jeffreys, 2: Type I Ind. Jeffreys, 3: Ind. Jeffreys).

set

Indicator for the use of set observations (1: set observations, 0: point observations). The former is strongly recommended over the latter as point observations cause problems in the context of Bayesian inference (due to continuous sampling models assigning zero probability to a point).

eps_l

Lower imprecision (ε_l) for set observations (default value: 0.5).

eps_r

Upper imprecision (ε_r) for set observations (default value: 0.5)

Value

A matrix with N / thin + 1 rows. The columns are the MCMC chains for β (k columns), σ^2 (1 column), θ (1 column, if appropriate), λ (n columns, not provided for log-normal model), \log(t) (n columns, simulated via data augmentation) and the logarithm of the adaptive variances (the number varies among models). The latter allows the user to evaluate if the adaptive variances have been stabilized.

Examples

library(BASSLINE)

# Please note: N=1000 is not enough to reach convergence.
# This is only an illustration. Run longer chains for more accurate
# estimations.

LLAP <- MCMC_LLAP(N = 1000, thin = 20, burn = 40, Time = cancer[, 1],
                  Cens = cancer[, 2], X = cancer[, 3:11])


nathansam/SMLN documentation built on May 14, 2022, 9:07 p.m.