get_moments_cpp_doubletree: Calculate variational moments during the updates

View source: R/RcppExports.R

get_moments_cpp_doubletreeR Documentation

Calculate variational moments during the updates

Description

Get all moments that need updating when iterating over internal and leaf nodes; for both trees. When updating a node u, all the moments of the descendant nodes will be changed. A recalculation of the moments are necessary when moving on to another node.

Usage

get_moments_cpp_doubletree(
  prob1,
  prob2,
  mu_gamma,
  sigma_gamma,
  mu_alpha,
  sigma_alpha,
  anc1,
  anc2,
  cardanc1,
  cardanc2
)

Arguments

prob1, prob2

variational probabilities; prob1 is for s*_u - length p1; prob2 is for s_cu - a matrix pL1 by p2; in R, a list of pL1 length - each element being of length p2.

mu_gamma

variational Gaussian means (for s*_u=1 component) for J*K logit(class-specific response probabilities); (J,K,p1) array; In R, we used a list of p1 (J,K) matrices

sigma_gamma

variational Gaussian variances (for s*_u=1 component) for J*K logit(class-specific response probabilities); (J,K,p1) array; in R, we used a list o f p1 (J,K) matrices

mu_alpha

variational Gaussian mean vectors (for s_cu=1 component) - this is a pL1 by K-1 by p2 array; in R, we used a list of p2 matrices (each of dimension pL1 by K-1)

sigma_alpha

variational Gaussian variances (for s_cu=1 component)

  • this is an array of dimension (pL1, K-1, p2); in R, we used a list of p2 matrices, each of dimension pL1 by K-1.

anc1, anc2

anc1 is a list of pL1 vectors, each vector has the node ids of the ancestors in tree1; lengths may differ. The ancestors include the node concerned; similarly for anc2

cardanc1, cardanc2

cardanc1 is a numeric vector of length pL1; integers. The number of ancestors for each leaf node in tree1; similarly for cardanc2.

Value

a List

return List::create(Named("E_beta")=E_beta, Named("E_beta_sq")=E_beta_sq, Named("E_eta")=E_eta, Named("E_eta_sq")=E_eta_sq);


zhenkewu/doubletree documentation built on Oct. 21, 2023, 7:04 a.m.