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 where1
indicates acceptance of the proposal tree and0
indicates 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_iters
xK
xJ
array of posterior samples of item response probabilitiesclass_probs_samples
a
K
xtotal_iters
matrix of posterior samples of class probabilitiesZ_samples
a
N
xtotal_iters
integer matrix of posterior samples of individual class assignmentsSigma_by_group_samples
a
G
xtotal_iters
matrix of posterior samples of diffusion variancesc_samples
a
total_iters
vector of posterior samples of divergence function hyperparameterloglikelihood
a
total_iters
vector of log-likelihoods of the full modelloglikelihood_lcm
a
total_iters
vector of log-likelihoods of the LCM model onlysetting
a list of model setup information, including:
K
,item_membership_list
, andG
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 of1
or2
(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)