| 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_samples
- a list of information of the tree collected from the sampling algorithm, including: - accept: a binary vector where- 1indicates acceptance of the proposal tree and- 0indicates 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_samples
- a - total_itersx- Kx- Jarray of posterior samples of item response probabilities
- class_probs_samples
- a - Kx- total_itersmatrix of posterior samples of class probabilities
- Z_samples
- a - Nx- total_itersinteger matrix of posterior samples of individual class assignments
- Sigma_by_group_samples
- a - Gx- total_itersmatrix of posterior samples of diffusion variances
- c_samples
- a - total_itersvector of posterior samples of divergence function hyperparameter
- loglikelihood
- a - total_itersvector of log-likelihoods of the full model
- loglikelihood_lcm
- a - total_itersvector of log-likelihoods of the LCM model only
- setting
- a list of model setup information, including: - K,- item_membership_list, and- G
- controls
- a 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 of- 1or- 2(see Arguments))
- data
- the 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)