bayesmlogit {bayesmlogit}R Documentation

Multistate Life Table Method

Description

A Bayesian Multistate Life Table Method for survey data, developed by Lynch and Zang (2022), allowing for large state spaces with quasi-absorbing states (i.e., structural zeros in a transition matrix).

Usage

bayesmlogit(
  y,
  X,
  file_path = NA,
  samp = 1000,
  burn = 500,
  verbose = 100,
  thin = 5,
  trace.plot = FALSE
)

Arguments

y

A vector of state transitions, which can be created either manually or with CreateTrans(). See more details using ?lifedata.

X

A matrix of covariates. Note that X must include age as a covariate.

file_path

The file path for outputs. If a path is specified, the result will also be saved in the given file path. You can find two result files in the specified file: result.txt and resultwstep.txt. The former contains all posterior samples generated after burn-in. The latter is sampled from the former one with a specified sampling interval.

samp

Number of posterior samples. For efficiency purposes, if you need a large sample (e.g., \ge5000), we recommend parallel computing in a cluster.

burn

'burn-in' period. Default is 500.

verbose

Progress report. Default is 10, which means this function will report the current progress for every 10 posterior samples.

thin

The thinning strategy to reduce autocorrelation. For example, if thin = 5, this function will select 1 from every 5 posterior samples and generate a new dataset named outwstepwidth.txt. Default is 5.

trace.plot

If TRUE, this function will create a new directory under given file_path and output corresponding trace plots using samples after burn-in.

Details

This function came from the deprecated bayeslogit package, which conducts Bayesian multinomial logistic regressions using Polya-Gamma latent variables (Polson et al. 2013). It should be jointly used with the mlifetable() function, which will generate life tables based on the estimates from regressions.

Value

A list that contains two arrays:

The number of columns in both arrays is determined by the number of covariates in X and the number of unique transition status in y. For example, if we have 12 covariates in X and 36 unique transitions in y, our result will contain (12+1)*(36-1)= 455 columns in total.

See Also

mlifeTable, lifedata, CreateTrans

Examples

## Not run: 
data <- lifedata
y <- data[,1]
X <- data[,-1]

# This example will take about 30 mins.
out <- bayesmlogit(y, X ,samp=1000, burn=500,verbose=10)



## End(Not run)

[Package bayesmlogit version 1.0.1 Index]