initialize_tree_lcm: Initialize the variational inferential algorithm for latent...

View source: R/initialize.R

initialize_tree_lcmR Documentation

Initialize the variational inferential algorithm for latent class model with tree structured shrinkage

Description

Initialize the variational inferential algorithm for latent class model with tree structured shrinkage

Usage

initialize_tree_lcm(
  Y,
  A,
  Z_obs,
  leaf_ids_units,
  leaf_ids_nodes,
  ancestors,
  h_pau,
  levels,
  vi_params,
  hyperparams,
  hyper_fixed,
  random_init,
  random_init_vals,
  subject_id_list,
  v_units,
  shared_tau
)

Arguments

Y

matrix of binary observations for LCM - rows ordered by leaves in the tree

A

a p by p binary matrix: each row is the ancestors including the node itself; ordered by leaves in the tree

Z_obs

a two-column matrix of integers, first column is subject ids, second column is a mix of NA and integers, NA means unknown class indicators, an integer indicates the known class.

leaf_ids_units

The subject ids in each leaf node (a list)

leaf_ids_nodes

the leaf descendants for each internal or leaf nodes (a list)

ancestors

a numeric vector of ancestor nodes for each leaf node (a list of length equal to the number of leaves)

h_pau

a numeric vector (length = # nodes); the edge length between a node and its parent node. The root node has no parent, because we suggest a separate prior variance for the root node's gamma and alpha, we set the "edge-length" toward root node as 1.

levels

a numeric vector of integers from 1 to L, indicating for each node (leaf or internal node) which set of hyperparameters to use. For example, if we want the root node to have a separate tau_1 and tau_2, can specify it to its own level. Another example would be to have distinct sets of hyperparameters for leaf and non-leaf nodes. The levels are pre-specified, not estimated.

vi_params

the list of variational parameters. mu_gamma, mu_alpha, prob (for s_u), a_t, b_t,sigma_gamma, Sigma_alpha prob,prob_gamma=c(1,rep(0,p-1)) (this is not updated).

hyperparams

the list of hyperparameters, tau_1 and tau_2 - these are initial specifications of the hyperparameters - they are updated by tau_1_t, tau_2_t; psi, g_psi, phi, g_phi (these are not hyperparameters, but are updated in the same function as tau_1_t and tau_2_t), but more frequently.

hyper_fixed

a list of fixed hyperparameters, such as those in the Beta priors for rho, e.g., list(a=c(1,1,99),b=c(1,1,1)), K, number of classes. for three levels, where the first and second levels are uniform Beta, the third level has Beta(99,1) prior - this nearly ensures setting s_u=1.

random_init

logical; TRUE for adding additional variability to the initial values. This is needed if the algorithm needs multiple random starts to choose the best converged values.

random_init_vals

NB: fill out specific elements

subject_id_list, v_units, shared_tau

see update_vi_params()

Value

a list vi_params,hyperparams containing the initial values.


zhenkewu/lotR documentation built on April 24, 2022, 2:36 a.m.