plot.cp_model_lmer | R Documentation |
Creates a ggplot2 visualization of a fitted mixed-effects cross-price demand model
(of class cp_model_lmer
). This function allows you to plot:
## S3 method for class 'cp_model_lmer'
plot(
x,
data = NULL,
x_trans = "identity",
y_trans = "identity",
n_points = 100,
xlab = "Price",
ylab = "Consumption",
title = NULL,
point_size = 3,
pred_type = c("fixed", "random", "all"),
...
)
x |
A |
data |
Optional data frame containing columns |
x_trans |
Transformation for the x-axis; one of |
y_trans |
Transformation for the y-axis; one of |
n_points |
Number of points to use in creating the prediction grid. Default is |
xlab |
Label for the x-axis. Default is |
ylab |
Label for the y-axis. Default is |
title |
Optional title for the plot; default is |
point_size |
Size of the observed data points. Default is |
pred_type |
Character string specifying which prediction components to plot:
The default is |
... |
Additional arguments passed to |
"fixed"
Only the population-level (fixed-effects) prediction.
"random"
Only the subject-specific predictions.
"all"
Both: the fixed-effects and the subject-specific predictions.
If the model includes group effects, separate lines will be drawn for each group.
A ggplot2 object displaying the observed data points along with the prediction curves.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.