predict.cp_model_lmer | R Documentation |
Generates predictions from a mixed-effects cross-price demand model (of class
cp_model_lmer
). The function supports two modes:
## S3 method for class 'cp_model_lmer'
predict(object, newdata = NULL, pred_type = c("fixed", "random"), ...)
object |
A |
newdata |
A data frame containing at least an |
pred_type |
Character string specifying the type of prediction: either |
... |
Additional arguments passed to the underlying |
"fixed"
Returns predictions based solely on the fixed-effects component
(using re.form = NA
).
"random"
Returns subject-specific predictions (fixed plus random effects)
(using re.form = NULL
).
A data frame containing all columns of newdata
plus a column y_pred
with the corresponding predictions.
## Not run:
# Population-level predictions:
predict(fit_out_3, newdata = ex_sub, pred_type = "fixed")
# Subject-specific predictions:
predict(fit_out_3, newdata = ex_sub, pred_type = "random")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.