predict.stepmix.stepmix.StepMix {stepmixr}R Documentation

Predict the membership (probabilities) using the fit of the stepmix python package.

Description

Predict the membership (probabilities) of a mixture using a stepmix object in python using X and optionally Y to the object.

Usage

## S3 method for class 'stepmix.stepmix.StepMix'
predict(object, X = NULL, Y = NULL, ...)
## S3 method for class 'stepmix.stepmix.StepMix'
predict_proba(object, X = NULL, Y = NULL, ...)

Arguments

object

An object created with the fit function.

X

The X matrix or data.frame for the measurement part of the model

Y

The Y matrix or data.frame for the structural part of the model

...

not used in this function

Value

A vector containing the membership (probabilities) of the mixture.

Author(s)

Éric Lacourse, Roxane de la Sablonnière, Charles-Édouard Giguère, Sacha Morin, Robin Legault, Zsusza Bakk

References

Bolck, A., Croon, M., and Hagenaars, J. Estimating latent structure models with categorical variables: One-step versus three-step estimators. Political analysis, 12(1): 3-27, 2004.

Vermunt, J. K. Latent class modeling with covariates: Two improved three-step approaches. Political analysis, 18 (4):450-469, 2010.

Bakk, Z., Tekle, F. B., and Vermunt, J. K. Estimating the association between latent class membership and external variables using bias-adjusted three-step approaches. Sociological Methodology, 43(1):272-311, 2013.

Bakk, Z. and Kuha, J. Two-step estimation of models between latent classes and external variables. Psychometrika, 83(4):871-892, 2018

Examples

## Not run: 
if (reticulate::py_module_available("stepmix")) {
  require(stepmixr)
  model1 <- stepmix(n_components = 3, n_steps = 2, measurement = "continuous", progress_bar = 0)
  X <- iris[c(1:10, 51:60, 101:110), 1:4]
  fit1 <- fit(model1, X)
  pr1 <- predict(fit1, X)
}

## End(Not run)

[Package stepmixr version 0.1.2 Index]