update_classes_wb: Weight-based update of latent classes

View source: R/RcppExports.R

update_classes_wbR Documentation

Weight-based update of latent classes

Description

This function updates the latent classes based on their class weights.

Usage

update_classes_wb(Cmax, epsmin, epsmax, distmin, s, b, Omega)

Arguments

Cmax

The maximum number of classes.

epsmin

The threshold weight (between 0 and 1) for removing a class.

epsmax

The threshold weight (between 0 and 1) for splitting a class.

distmin

The (non-negative) threshold difference in class means for joining two classes.

s

The vector of class weights of length C. Set to NA if P_r = 0. For identifiability, the vector must be non-ascending.

b

The matrix of class means as columns of dimension P_r x C. Set to NA if P_r = 0.

Omega

The matrix of class covariance matrices as columns of dimension P_r*P_r x C. Set to NA if P_r = 0.

Details

The updating scheme bases on the following rules:

  • We remove class c, if s_c<\epsilon_{min}, i.e. if the class weight s_c drops below some threshold \epsilon_{min}. This case indicates that class c has a negligible impact on the mixing distribution.

  • We split class c into two classes c_1 and c_2, if s_c>\epsilon_{max}. This case indicates that class c has a high influence on the mixing distribution whose approximation can potentially be improved by increasing the resolution in directions of high variance. Therefore, the class means b_{c_1} and b_{c_2} of the new classes c_1 and c_2 are shifted in opposite directions from the class mean b_c of the old class c in the direction of the highest variance.

  • We join two classes c_1 and c_2 to one class c, if ||b_{c_1} - b_{c_2}||<\epsilon_{distmin}, i.e. if the euclidean distance between the class means b_{c_1} and b_{c_2} drops below some threshold \epsilon_{distmin}. This case indicates location redundancy which should be repealed. The parameters of c are assigned by adding the values of s from c_1 and c_2 and averaging the values for b and \Omega. The rules are executed in the above order, but only one rule per iteration and only if Cmax is not exceeded.

Value

A list of updated values for s, b, and Omega.

Examples

### parameter settings
s <- c(0.8,0.2)
b <- matrix(c(1,1,1,-1), ncol=2)
Omega <- matrix(c(0.5,0.3,0.3,0.5,1,-0.1,-0.1,0.8), ncol=2)

### Remove class 2
RprobitB:::update_classes_wb(Cmax = 10, epsmin = 0.3, epsmax = 0.9, distmin = 1,
                             s = s, b = b, Omega = Omega)

### Split class 1
RprobitB:::update_classes_wb(Cmax = 10, epsmin = 0.1, epsmax = 0.7, distmin = 1,
                             s = s, b = b, Omega = Omega)

### Join classes
RprobitB:::update_classes_wb(Cmax = 10, epsmin = 0.1, epsmax = 0.9, distmin = 3,
                             s = s, b = b, Omega = Omega)

loelschlaeger/RprobitB documentation built on Oct. 15, 2024, 11:08 a.m.