RMWreg_MCMC: MCMC sampler to fit a RMW AFT regression model

Description Usage Arguments Value Author(s) Examples

View source: R/Functions.R

Description

MCMC sampler to fit a RMW AFT regression model

Usage

1
2
3
RMWreg_MCMC(N, Thin, Burn, Time, Event, DesignMat, Mixing = "None",
  BaseModel = "Weibull", PriorCV = "Pareto", PriorMeanCV = 1.5,
  Hyp1Gam = 1, Hyp2Gam = 1, ...)

Arguments

N

Total number of iterations for the MCMC sampler. Use N>=max(4,Thin), N being a multiple of Thin.

Thin

Thining period for the MCMC sampler. Use Thin>=2.

Burn

Burn-in period for the MCMC sampler. Use Burn>=1, Burn<N, Burn being a multiple of Thin.

Time

Vector of length n containing survival times

Event

Vector of length n containing event indicators (TRUE / 1 is the event is observed, FALSE / 0 is the event is Eventored)

Mixing

Mixing distribution assigned to the (frailty) random effects. Possible values are "None", "Exponential", "Gamma", "InvGamma", "InvGauss", "LogNormal"

BaseModel

If BaseModel = "Weibull", a RMW regression is used. If BaseModel = "Exponential", a RME regression is used.

PriorCV

Type of prior assigned to the coefficient of variation of the survival times. Possible values are "Pareto", "TruncExp"

PriorMeanCV

Ellicited prior mean of the coefficient of variation (PriorMeanCV > 1). If Mixing = "InvGamma", PriorMeanCV must be below sqrt{3}. If Mixing = "InvGauss", PriorMeanCV must be below sqrt{5}. Default: PriorMeanCV = 1.5

Hyp1Gam

Shape hyper-parameter for the Gamma(Hyp1Gam, Hyp2Gam) assigned to gam.

Hyp2Gam

Rate hyper-parameter for the Gamma(Hyp1Gam, Hyp2Gam) assigned to gam.

...

Optional parameters.

AR

Optimal acceptance rate for adaptive Metropolis Hastings updates. It must be a positive number between 0 and 1. Default (and recommended): ar = 0.44

.

StopAdapt

Iteration at which adaptive proposals are not longer adapted. Use stopAdapt>=1. Default: StopAdapt = Burn.

StoreChains

If StoreChains = TRUE, MCMC chains of each parameter are stored in separate .txt files. (RunName argument used for file names). Default: StoreChains = FALSE.

StoreAdapt

If StoreAdapt = TRUE, trajectory of adaptive proposal variances (log scale) for each parameter are stored in separate .txt files. (RunName argument used for file names). Default: StoreAdapt = FALSE.

StoreDir

Directory where MCMC chain will be stored (only required if Store = TRUE). Default: StoreDir = getwd().

RunName

Run-name to be used when storing chains and/or adaptive proposal variances in .txt files.

PrintProgress

If PrintProgress = TRUE, intermediate output is displayed in the console.

Value

A list containing MCMC draws for all parameters.

Author(s)

Catalina A. Vallejos cvallejos@turing.ac.uk

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
library(KMsurv)
data(alloauto)
n=dim(alloauto)[1]; k=2
Intercept=rep(1,times=n); x1=alloauto$type-1
DesignMat=cbind(Intercept,x1); rm(Intercept)
Time=alloauto$time; Event=alloauto$delta

Chain <- RMWreg_MCMC(N = 100, Thin = 2, Burn = 50,
                     Time, Event, DesignMat,
                     Mixing = "None", BaseModel = "Weibull",
                     PriorCV = "Pareto", PriorMeanCV = 1.5,
                     Hyp1Gam = 1, Hyp2Gam = 1)

catavallejos/RMWreg documentation built on Nov. 7, 2019, 2:01 p.m.