| ddtlcm_fit {ddtlcm} | R Documentation |
MH-within-Gibbs sampler to sample from the full posterior distribution of DDT-LCM
Description
Use DDT-LCM to estimate latent class and tree on class profiles for multivariate binary outcomes.
Usage
ddtlcm_fit(
K,
data,
item_membership_list,
total_iters = 5000,
initials = list(),
priors = list(),
controls = list(),
initialize_args = list(method_lcm = "random", method_dist = "euclidean", method_hclust
= "ward.D", method_add_root = "min_cor", alpha = 0, theta = 0)
)
Arguments
K |
number of classes (integer) |
data |
an NxJ matrix of multivariate binary responses, where N is the number of individuals, and J is the number of granular items |
item_membership_list |
a list of G elements, where the g-th element contains the column
indices of |
total_iters |
number of posterior samples to collect (integer) |
initials |
a named list of initial values of the following parameters:
Parameters not supplied with initial values will be initialized using the |
priors |
a named list of values of hyperparameters of priors. See the function
|
controls |
a named list of control variables.
|
initialize_args |
a named list of initialization arguments. See the function
|
Value
an object of class "ddt_lcm"; a list containing the following elements:
tree_samplesa list of information of the tree collected from the sampling algorithm, including:
accept: a binary vector where1indicates acceptance of the proposal tree and0indicates rejection.tree_list: a list of posterior samples of the tree.dist_mat_list: a list of tree-structured covariance matrices representing the marginal covariances among the leaf parameters, integrating out the internal node parameters and all intermediate stochastic paths in the DDT branching process.response_probs_samplesa
total_itersxKxJarray of posterior samples of item response probabilitiesclass_probs_samplesa
Kxtotal_itersmatrix of posterior samples of class probabilitiesZ_samplesa
Nxtotal_itersinteger matrix of posterior samples of individual class assignmentsSigma_by_group_samplesa
Gxtotal_itersmatrix of posterior samples of diffusion variancesc_samplesa
total_itersvector of posterior samples of divergence function hyperparameterloglikelihooda
total_itersvector of log-likelihoods of the full modelloglikelihood_lcma
total_itersvector of log-likelihoods of the LCM model onlysettinga list of model setup information, including:
K,item_membership_list, andGcontrolsa list of model controls, including:
fix_tree: FALSE to perform MH sampling of the tree, TRUE to fix the tree at the initial input.c_order: a numeric value of1or2(see Arguments))datathe input data matrix
Examples
# load the MAP tree structure obtained from the real HCHS/SOL data
data(data_synthetic)
# extract elements into the global environment
list2env(setNames(data_synthetic, names(data_synthetic)), envir = globalenv())
# run DDT-LCM
result <- ddtlcm_fit(K = 3, data = response_matrix, item_membership_list, total_iters = 50)