# Latent Class Analysis with Dirichlet Diffusion Tree Process Prior

## Documentation for package ‘ddtlcm’ version 0.2.1

- DESCRIPTION file.
- User guides, package vignettes and other documentation.
- Package NEWS.

## Help Pages

add_leaf_branch | Add a leaf branch to an existing tree tree_old
add_multichotomous_tip | Add a leaf branch to an existing tree tree_old to make a multichotomus branch
add_one_sample | Functions to simulate trees and node parameters from a DDT process. Add a branch to an existing tree according to the branching process of DDT
add_root | Add a singular root node to an existing nonsingular tree
attach_subtree | Attach a subtree to a given DDT at a randomly selected location
A_t_inv_one | Compute divergence function
A_t_inv_two | Compute divergence function
a_t_one | Compute divergence function
a_t_one_cum | Compute divergence function
a_t_two | Compute divergence function
a_t_two_cum | Compute divergence function
compute_IC | Compute information criteria for the DDT-LCM model
create_leaf_cor_matrix | Create a tree-structured covariance matrix from a given tree
data_synthetic | Synthetic data example
ddtlcm_fit | MH-within-Gibbs sampler to sample from the full posterior distribution of DDT-LCM
div_time | Sample divergence time on an edge uv previously traversed by m(v) data points
draw_mnorm | Efficiently sample multivariate normal using precision matrix from x ~ N(Q^{-1}a, Q^{-1}), where Q^{-1} is the precision matrix
expit | The expit function
exp_normalize | Compute normalized probabilities: exp(x_i) / sum_j exp(x_j)
H_n | Harmonic series
initialize | Initialize the MH-within-Gibbs algorithm for DDT-LCM
initialize_hclust | Estimate an initial binary tree on latent classes using hclust()
initialize_poLCA | Estimate an initial response profile from latent class model using poLCA()
initialize_randomLCM | Provide a random initial response profile based on latent class mode
J_n | Compute factor in the exponent of the divergence time distribution
logit | The logistic function
logllk_ddt | Calculate loglikelihood of a DDT, including the tree structure and node parameters
logllk_ddt_lcm | Calculate loglikelihood of the DDT-LCM
logllk_div_time_one | Compute loglikelihood of divergence times for a(t) = c/(1-t)
logllk_div_time_two | Compute loglikelihood of divergence times for a(t) = c/(1-t)^2
logllk_lcm | Calculate loglikelihood of the latent class model, conditional on tree structure
logllk_location | Compute log likelihood of parameters
logllk_tree_topology | Compute loglikelihood of the tree topology
log_expit | Numerically accurately compute f(x) = log(x / (1/x)).
parameter_diet | Parameters for the HCHS dietary recall data example
plot.ddt_lcm | Create trace plots of DDT-LCM parameters
plot.summary.ddt_lcm | Plot the MAP tree and class profiles of summarized DDT-LCM results
plot_tree_with_barplot | Plot the MAP tree and class profiles (bar plot) of summarized DDT-LCM results
plot_tree_with_heatmap | Plot the MAP tree and class profiles (heatmap) of summarized DDT-LCM results
predict.ddt_lcm | Prediction of class memberships from posterior predictive distributions
predict.summary.ddt_lcm | Prediction of class memberships from posterior summaries
print.ddt_lcm | Print out setup of a ddt_lcm model
print.summary.ddt_lcm | Print out summary of a ddt_lcm model
proposal_log_prob | Calculate proposal likelihood
quiet | Suppress print from cat()
random_detach_subtree | Metropolis-Hasting algorithm for sampling tree topology and branch lengths from the DDT branching process.
reattach_point | Attach a subtree to a given DDT at a randomly selected location
result_diet_1000iters | Result of fitting DDT-LCM to a semi-synthetic data example
sample_class_assignment | Sample individual class assignments Z_i, i = 1, ..., N
sample_c_one | Sample divergence function parameter c for a(t) = c / (1-t) through Gibbs sampler
sample_c_two | Sample divergence function parameter c for a(t) = c / (1-t)^2 through Gibbs sampler
sample_leaf_locations_pg | Sample the leaf locations and Polya-Gamma auxilliary variables
sample_sigmasq | Sample item group-specific variances through Gibbs sampler
sample_tree_topology | Sample a new tree topology using Metropolis-Hastings through randomly detaching and re-attaching subtrees
simulate_DDT_tree | Simulate a tree from a DDT process. Only the tree topology and branch lengths are simulated, without node parameters.
simulate_lcm_given_tree | Simulate multivariate binary responses from a latent class model given a tree
simulate_lcm_response | Simulate multivariate binary responses from a latent class model
simulate_parameter_on_tree | Simulate node parameters along a given tree.
summary.ddt_lcm | Summarize the output of a ddt_lcm model
WAIC | Compute WAIC