skipTrack.MCMC | R Documentation |
This function runs a single Markov Chain Monte Carlo (MCMC) chain to update parameters in the skipTrack hierarchical model.
skipTrack.MCMC(
Y,
cluster,
X = matrix(1, nrow = length(cluster)),
Z = matrix(1, nrow = length(cluster)),
numSkips = 10,
reps = 1000,
fixedSkips = FALSE,
initialParams = list(pi = rep(1/(numSkips + 1), numSkips + 1), muis = rep(log(30),
length(unique(cluster))), tauis = rep(5, length(unique(cluster))), rho = 1, cijs =
sample(1:3, length(Y), replace = TRUE), alphas = rep(1, numSkips + 1), Beta =
matrix(rep(0, ncol(as.matrix(X))), 1), Gamma = matrix(rep(0, ncol(as.matrix(Z))), 1),
rhoBeta = 0.01, rhoGamma = 1000, phi = 0.01, rhoPhi = 1000),
verbose = FALSE
)
Y |
A vector of observed cycle lengths. |
cluster |
A vector indicating the individual cluster/group membership for each observation Y. |
X |
A matrix (length(Y) x length(Beta)) of covariates for cycle length mean. Default is a vector of 1's. |
Z |
A matrix (length(Y) x length(Gamma)) of covariates for cycle length precision. Default is a vector of 1's. |
numSkips |
The maximum number of skips to allow. Default is 10. |
reps |
The number of MCMC iterations (steps) to perform. Default is 1000. |
fixedSkips |
If TRUE cycle skip information (cijs) is not updated in sample steps and the inputs are instead assumed to be true. |
initialParams |
A list of initial parameter values for the MCMC algorithm. Default values are provided for pi, muis, tauis, rho, cijs, alphas, Beta, Gamma, phi, rhoBeta, rhoGamma, and rhoPhi. |
verbose |
logical. If true progress bars and additional info are printed to the console. |
A list containing the MCMC draws for each parameter at each iteration. Each element in the list is itself a list containing:
A data.frame with updated parameters at the individual-observation level: Individual, ys, cijs, muis, tauis.
A data.frame with updated parameters at the individual level: Individual, mus, taus, thetas.
Updated value of the global parameter rho.
Updated value of the global parameter pi.
Matrix of covariates for cycle length mean.
Matrix of covariates for cycle length precision.
Updated matrix of coefficients for cycle length mean.
Updated matrix of coefficients for cycle length precision.
Vector of prior alpha values for updating pi.
A logical vector indicating the first occurrence of each individual.
Hyperprior parameter rhoBeta, used to update Beta.
Value of the proposal parameter rhoGamma.
Updated value of the parameter phi.
Value of the proposal parameter rhoPhi.
Logical. Indicates if skips were fixed.
sampleStep
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.