bayesmlogit {bayesmlogit} | R Documentation |
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).
bayesmlogit(
y,
X,
file_path = NA,
samp = 1000,
burn = 500,
verbose = 100,
thin = 5,
trace.plot = FALSE
)
y |
A vector of state transitions, which can be created either manually or with |
X |
A matrix of covariates. Note that |
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: |
samp |
Number of posterior samples. For efficiency purposes, if you need a large sample (e.g., |
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 |
trace.plot |
If TRUE, this function will create a new directory under given |
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.
A list that contains two arrays:
out: An array that contains all posterior samples generated.
outwstepwidth: An array generated by selecting one sample from every thin samples in out.
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.
mlifeTable
, lifedata
, CreateTrans
## 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)