View source: R/mixture-regression-predict.R
| simulate.latents_mixture_regression | R Documentation |
Draws class memberships from the fitted mixing model (group classes first
in the two-level model, one class per group under class_level = "group"), then outcomes from each row's class regression, at the fitted
rows' predictors.
## S3 method for class 'latents_mixture_regression'
simulate(object, nsim = 1, seed = NULL, ...)
object |
A fit from |
nsim |
Number of simulated outcome vectors. |
seed |
|
... |
Unused. |
A base data.frame with one row per fitted row and one column per
simulation, sim_1, sim_2, ...; for a binomial fit with more than one
trial the columns hold success counts, and for an ordinal fit the
fitted categories in the outcome's own type (a factor with the fitted
levels, or the category numbers).
fit <- mixture_regression(score ~ hours, data = study_hours, n_classes = 2,
n_starts = 3, seed = 1)
head(simulate(fit, nsim = 2, seed = 1))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.