View source: R/hurdle-methods.R
| plot.beezdemand_hurdle | R Documentation |
Creates visualizations of fitted demand curves from a hurdle demand model.
## S3 method for class 'beezdemand_hurdle'
plot(
x,
type = c("demand", "population", "probability", "parameters", "individual", "both"),
ids = NULL,
subjects = NULL,
parameters = c("Q0", "alpha", "breakpoint", "Pmax", "Omax"),
prices = NULL,
show_population = TRUE,
show_pred = NULL,
show_observed = TRUE,
x_trans = c("log10", "log", "linear", "pseudo_log"),
y_trans = NULL,
free_trans = 0.01,
facet = NULL,
x_limits = NULL,
y_limits = NULL,
x_lab = NULL,
y_lab = NULL,
xlab = NULL,
ylab = NULL,
style = c("modern", "apa"),
observed_point_alpha = 0.5,
observed_point_size = 1.8,
pop_line_alpha = 0.9,
pop_line_size = 1,
ind_line_alpha = 0.35,
ind_line_size = 0.7,
...
)
x |
An object of class |
type |
Character string specifying the plot type:
|
ids |
Optional vector of subject IDs to plot (alias of |
subjects |
Character or numeric vector of subject IDs to plot for
|
parameters |
Character vector specifying which parameters to plot when
|
prices |
Numeric vector of prices for plotting. If |
show_population |
Logical; if |
show_pred |
Which prediction layers to plot: "population", "individual", or "both". |
show_observed |
Logical; if |
x_trans |
Character. Transformation for x-axis. Default "log". |
y_trans |
Character. Transformation for y-axis. Default "log". |
free_trans |
Value used to display free (x = 0) on log scales. Use NULL to drop x <= 0 values instead. |
facet |
Faceting specification (TRUE for |
x_limits |
Optional numeric vector of length 2 for x-axis limits. |
y_limits |
Optional numeric vector of length 2 for y-axis limits. |
x_lab |
Optional x-axis label. |
y_lab |
Optional y-axis label. |
xlab |
Deprecated alias for |
ylab |
Deprecated alias for |
style |
Plot styling, passed to |
observed_point_alpha |
Alpha for observed points. |
observed_point_size |
Size for observed points. |
pop_line_alpha |
Alpha for population curve. |
pop_line_size |
Line size for population curve. |
ind_line_alpha |
Alpha for individual curves. |
ind_line_size |
Line size for individual curves. |
... |
Additional arguments (currently unused). |
A ggplot2 object.
data(apt)
fit <- fit_demand_hurdle(apt, y_var = "y", x_var = "x", id_var = "id")
# Plot mean demand curve
plot(fit)
# Plot parameter distributions
plot(fit, type = "parameters")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.