Check Assumption and Fix Label Switching if Assumption is Broken for a List of MCMC Samples
check_and_fix_chains_2stage.Rd
Check Assumption and Fix Label Switching if Assumption is Broken for a List of MCMC Samples
Usage
check_and_fix_chains_2stage(
n_chains,
chains_list,
pistarjj_matrix,
pitildejjj_matrix,
dim_x,
dim_z,
dim_v,
n_cat
)
Arguments
- n_chains
An integer specifying the number of MCMC chains to compute over.
- chains_list
A numeric list containing the samples from
n_chains
MCMC chains.- pistarjj_matrix
A numeric matrix of the average conditional probability \(P(Y^* = j | Y = j, Z)\) across all subjects for each MCMC chain, obtained from the
pistar_by_chain
function.- pitildejjj_matrix
A numeric matrix of the average conditional probability \(P( \tilde{Y} = j | Y^* = j, Y = j, V)\) across all subjects for each MCMC chain. Rows of the matrix correspond to MCMC chains, up to
n_chains
. Obtained from thepitilde_by_chain
function.- dim_x
The number of columns of the design matrix of the true outcome mechanism,
X
.- dim_z
The number of columns of the design matrix of the first-stage observation mechanism,
Z
.- dim_v
The number of columns of the design matrix of the second-stage observation mechanism,
V
.- n_cat
The number of categorical values that the true outcome,
Y
, and the observed outcome,Y*
can take.