plot.cp_model_lm | R Documentation |
Creates a ggplot2 visualization of a fitted linear cross-price demand model
(of class cp_model_lm
). The plot overlays a prediction line over the
observed data points. Axis transformations (e.g., "log10"
) can be applied.
If the model includes group effects, separate lines will be drawn for each group.
## S3 method for class 'cp_model_lm'
plot(
x,
data = NULL,
x_trans = "identity",
y_trans = "identity",
n_points = 100,
xlab = "Price",
ylab = "Consumption",
title = NULL,
point_size = 3,
...
)
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 create in 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 data points in the plot. Default is |
... |
Additional arguments passed to the generic |
A ggplot2 object displaying the fitted model predictions and observed data.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.