Package: ddtlcm 0.2.1

Mengbing Li

ddtlcm: Latent Class Analysis with Dirichlet Diffusion Tree Process Prior

Implements a Bayesian algorithm for overcoming weak separation in Bayesian latent class analysis. Reference: Li et al. (2023) <arxiv:2306.04700>.

Authors:Mengbing Li [cre, aut], Briana Stephenson [ctb], Zhenke Wu [ctb]

ddtlcm_0.2.1.tar.gz
ddtlcm_0.2.1.zip(r-4.5)ddtlcm_0.2.1.zip(r-4.4)ddtlcm_0.2.1.zip(r-4.3)
ddtlcm_0.2.1.tgz(r-4.4-any)ddtlcm_0.2.1.tgz(r-4.3-any)
ddtlcm_0.2.1.tar.gz(r-4.5-noble)ddtlcm_0.2.1.tar.gz(r-4.4-noble)
ddtlcm_0.2.1.tgz(r-4.4-emscripten)ddtlcm_0.2.1.tgz(r-4.3-emscripten)
ddtlcm.pdf |ddtlcm.html
ddtlcm/json (API)
NEWS

# Install 'ddtlcm' in R:
install.packages('ddtlcm', repos = c('https://limengbinggz.r-universe.dev', 'https://cloud.r-project.org'))

Peer review:

Bug tracker:https://github.com/limengbinggz/ddtlcm/issues

Datasets:

On CRAN:

19 exports 5 stars 2.01 score 141 dependencies 8 scripts 155 downloads

Last updated 2 months agofrom:e012957499. Checks:OK: 1 NOTE: 6. Indexed: yes.

TargetResultDate
Doc / VignettesOKAug 25 2024
R-4.5-winNOTEAug 25 2024
R-4.5-linuxNOTEAug 25 2024
R-4.4-winNOTEAug 25 2024
R-4.4-macNOTEAug 25 2024
R-4.3-winNOTEAug 25 2024
R-4.3-macNOTEAug 25 2024

Exports:A_t_inv_oneA_t_inv_twoa_t_onea_t_one_cuma_t_twoa_t_two_cumcompute_ICcreate_leaf_cor_matrixddtlcm_fitexpitinitializelogitplot_tree_with_barplotplot_tree_with_heatmaprandom_detach_subtreesimulate_DDT_treesimulate_lcm_given_treesimulate_lcm_responsesimulate_parameter_on_tree

Dependencies:abindade4apeaplotaskpassbackportsBayesLogitbootbriobroomcallrcarcarDataclicolorspacecombinatcommonmarkcorrplotcowplotcpp11crayoncurldata.tableDerivdescdiffobjdigestdoBydplyrevaluateextraDistrfansifarverfsgenericsggfunggplot2ggplotifyggpubrggrepelggsciggsignifggtextggtreegluegridExtragridGraphicsgridtextgtablehmshttrhttr2isobandjpegjsonlitelabel.switchinglabelinglatticelazyevallifecyclelme4lpSolvemagrittrmarkdownMASSMatrixMatrixModelsmatrixStatsmgcvmicrobenchmarkmimeminqamodelrmunsellnlmenloptrnnetnumDerivopensslpatchworkpbkrtestphylobasepillarpixmappkgbuildpkgconfigpkgloadplyrpngpoLCApolynompraiseprettyunitsprocessxprogresspspurrrquantregR.methodsS3R.ooR.utilsR6rappdirsrbibutilsRColorBrewerRcppRcppArmadilloRcppEigenRdpackrematch2reshape2rlangrnclRNeXMLrprojrootrstatixscalesscatterplot3dspSparseMstringistringrsurvivalsystestthattibbletidyrtidyselecttidytreetreeiotruncnormutf8uuidvctrsviridisLitewaldowithrxfunXMLxml2yulab.utils

Vignettes for ddtlcm: An R package for fitting tree-regularized Bayesian latent class models

Rendered fromddtlcm-demo.Rmdusingknitr::rmarkdownon Aug 25 2024.

Last update: 2024-03-26
Started: 2023-08-24

Readme and manuals

Help Manual

Help pageTopics
Compute divergence functionA_t_inv_one a_t_one a_t_one_cum
Compute divergence functionA_t_inv_two a_t_two a_t_two_cum
Add a leaf branch to an existing tree tree_oldadd_leaf_branch
Add a leaf branch to an existing tree tree_old to make a multichotomus branchadd_multichotomous_tip
Functions to simulate trees and node parameters from a DDT process. Add a branch to an existing tree according to the branching process of DDTadd_one_sample
Add a singular root node to an existing nonsingular treeadd_root
Attach a subtree to a given DDT at a randomly selected locationattach_subtree
Compute information criteria for the DDT-LCM modelcompute_IC
Create a tree-structured covariance matrix from a given treecreate_leaf_cor_matrix
Synthetic data exampledata_synthetic
MH-within-Gibbs sampler to sample from the full posterior distribution of DDT-LCMddtlcm_fit
Sample divergence time on an edge uv previously traversed by m(v) data pointsdiv_time
Efficiently sample multivariate normal using precision matrix from x ~ N(Q^{-1}a, Q^{-1}), where Q^{-1} is the precision matrixdraw_mnorm
Compute normalized probabilities: exp(x_i) / sum_j exp(x_j)exp_normalize
The expit functionexpit
Harmonic seriesH_n
Initialize the MH-within-Gibbs algorithm for DDT-LCMinitialize
Estimate an initial binary tree on latent classes using hclust()initialize_hclust
Estimate an initial response profile from latent class model using poLCA()initialize_poLCA
Provide a random initial response profile based on latent class modeinitialize_randomLCM
Compute factor in the exponent of the divergence time distributionJ_n
Numerically accurately compute f(x) = log(x / (1/x)).log_expit
The logistic functionlogit
Calculate loglikelihood of a DDT, including the tree structure and node parameterslogllk_ddt
Calculate loglikelihood of the DDT-LCMlogllk_ddt_lcm
Compute loglikelihood of divergence times for a(t) = c/(1-t)logllk_div_time_one
Compute loglikelihood of divergence times for a(t) = c/(1-t)^2logllk_div_time_two
Calculate loglikelihood of the latent class model, conditional on tree structurelogllk_lcm
Compute log likelihood of parameterslogllk_location
Compute loglikelihood of the tree topologylogllk_tree_topology
Parameters for the HCHS dietary recall data exampleparameter_diet
Plot the MAP tree and class profiles (bar plot) of summarized DDT-LCM resultsplot_tree_with_barplot
Plot the MAP tree and class profiles (heatmap) of summarized DDT-LCM resultsplot_tree_with_heatmap
Create trace plots of DDT-LCM parametersplot.ddt_lcm
Plot the MAP tree and class profiles of summarized DDT-LCM resultsplot.summary.ddt_lcm
Prediction of class memberships from posterior predictive distributionspredict.ddt_lcm
Prediction of class memberships from posterior summariespredict.summary.ddt_lcm
Print out setup of a ddt_lcm modelprint.ddt_lcm
Print out summary of a ddt_lcm modelprint.summary.ddt_lcm
Calculate proposal likelihoodproposal_log_prob
Suppress print from cat()quiet
Metropolis-Hasting algorithm for sampling tree topology and branch lengths from the DDT branching process.random_detach_subtree
Attach a subtree to a given DDT at a randomly selected locationreattach_point
Result of fitting DDT-LCM to a semi-synthetic data exampleresult_diet_1000iters
Sample divergence function parameter c for a(t) = c / (1-t) through Gibbs samplersample_c_one
Sample divergence function parameter c for a(t) = c / (1-t)^2 through Gibbs samplersample_c_two
Sample individual class assignments Z_i, i = 1, ..., Nsample_class_assignment
Sample the leaf locations and Polya-Gamma auxilliary variablessample_leaf_locations_pg
Sample item group-specific variances through Gibbs samplersample_sigmasq
Sample a new tree topology using Metropolis-Hastings through randomly detaching and re-attaching subtreessample_tree_topology
Simulate a tree from a DDT process. Only the tree topology and branch lengths are simulated, without node parameters.simulate_DDT_tree
Simulate multivariate binary responses from a latent class model given a treesimulate_lcm_given_tree
Simulate multivariate binary responses from a latent class modelsimulate_lcm_response
Simulate node parameters along a given tree.simulate_parameter_on_tree
Summarize the output of a ddt_lcm modelsummary.ddt_lcm
Compute WAICWAIC