RprobitB_latent_classes: Create object of class 'RprobitB_latent_classes'

View source: R/model_fitting.R

RprobitB_latent_classesR Documentation

Create object of class RprobitB_latent_classes

Description

This function creates an object of class RprobitB_latent_classes which defines the number of latent classes and their updating scheme. The RprobitB_latent_classes object generated by this function is only of relevance if the model possesses at least one random coefficient, i.e. if P_r>0.

Usage

RprobitB_latent_classes(latent_classes = NULL)

Arguments

latent_classes

Either NULL (for no latent classes) or a list of parameters specifying the number of latent classes and their updating scheme:

  • C: The fixed number (greater or equal 1) of latent classes, which is set to 1 per default. If either weight_update = TRUE or dp_update = TRUE (i.e. if classes are updated), C equals the initial number of latent classes.

  • weight_update: A boolean, set to TRUE to weight-based update the latent classes. See ... for details.

  • dp_update: A boolean, set to TRUE to update the latent classes based on a Dirichlet process. See ... for details.

  • Cmax: The maximum number of latent classes.

  • buffer: The number of iterations to wait before a next weight-based update of the latent classes.

  • epsmin: The threshold weight (between 0 and 1) for removing a latent class in the weight-based updating scheme.

  • epsmax: The threshold weight (between 0 and 1) for splitting a latent class in the weight-based updating scheme.

  • distmin: The (non-negative) threshold in class mean difference for joining two latent classes in the weight-based updating scheme.

Details

Why update latent classes?

In order not to have to specify the number of latent classes before estimation.

What options to update latent classes exist?

Currently two updating schemes are implemented, weight-based and via a Dirichlet process, see the vignette on modeling heterogeneity.

What is the default behavior?

One latent class without updates is specified per default. Print an RprobitB_latent_classes-object to see a summary of all relevant (default) parameter settings.

Why is Cmax required?

The implementation requires an upper bound on the number of latent classes for saving the Gibbs samples. However, this is not a restriction since the number of latent classes is bounded by the number of deciders in any case. A plot method for visualizing the sequence of class numbers after estimation and can be used to check if Cmax was reached, see plot.RprobitB_fit.

Value

An object of class RprobitB_latent_classes.

Examples

### default setting
RprobitB:::RprobitB_latent_classes()

### setting for a fixed number of two latent classes
RprobitB:::RprobitB_latent_classes(list(C = 2))

### setting for weight-based on Dirichlet process-based updates
RprobitB:::RprobitB_latent_classes(
  list("weight_update" = TRUE, "dp_update" = TRUE)
)


RprobitB documentation built on Nov. 10, 2022, 5:12 p.m.