append_class_draws: Append Pseudo-class Draws

View source: R/mixture-pseudo_class.R

append_class_drawsR Documentation

Append Pseudo-class Draws

Description

Generates m datasets with random draws of a variable named class, with probability for these draws based on each case's probability of belonging to that class according to the model in x.

Usage

append_class_draws(x, data = NULL, m = 20)

Arguments

x

An object for which a method exists, usually a mx_mixture model.

data

A data.frame which the class variable is appended to. Note that the row order must be identical to that of the data used to fit x, as these data will be augmented with a pseudo-class draw for that specific individual.

m

Integer. Number of datasets to generate. Default is 10.

Value

A data.frame of class class_draws.

Examples

dat <- iris[c(1:5, 50:55, 100:105),1:3]
colnames(dat) <- letters[1:3]
fit <- mx_profiles(data = dat, classes = 2)

append_class_draws(fit, data = iris[c(1:5, 50:55, 100:105), 4, drop = FALSE])

cjvanlissa/tidySEM documentation built on March 16, 2024, 6:35 a.m.