| 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.
data(etm)
fit <- fit_cp_linear(etm, type = "mixed")
new_prices <- data.frame(x = c(2, 4, 8, 16, 32, 64))
predict(fit, newdata = new_prices, pred_type = "fixed")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.