View source: R/mixture-regression-predict.R
| predict.latents_mixture_regression | R Documentation |
Predict from a mixture-of-regressions fit
## S3 method for class 'latents_mixture_regression'
predict(
object,
newdata = NULL,
type = c("response", "class_response", "posterior", "probabilities"),
...
)
object |
A fit from |
newdata |
|
type |
|
... |
Unused. |
A base data.frame. For "response": row and fitted. For
"class_response": row, class, prior and fitted, one row per
data row and class. For "posterior": the same columns as
get_results(fit, "assignments"). For "probabilities": row,
class, category, prior and probability, one row per data row,
class and category. Raises latents_bad_argument for
"probabilities" with another family.
fit <- mixture_regression(score ~ hours, data = study_hours, n_classes = 2,
n_starts = 3, seed = 1)
new_students <- data.frame(hours = c(2, 10))
predict(fit, new_students, type = "class_response")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.