powered by
Creates a demand curve plot for a single subject with optional observed data and population reference curve.
plot_subject( object, subject_id, prices = NULL, show_data = TRUE, show_population = TRUE, style = c("modern", "apa") )
A ggplot2 object.
An object of class beezdemand_hurdle.
beezdemand_hurdle
The ID of the subject to plot.
Numeric vector of prices for plotting. If NULL, uses a sequence from 0 to max observed price.
NULL
Logical; if TRUE, overlay observed data points. Default is TRUE.
TRUE
Logical; if TRUE, show population curve. Default is TRUE.
Plot styling, passed to theme_beezdemand().
theme_beezdemand()
# \donttest{ data(apt) fit <- fit_demand_hurdle(apt, y_var = "y", x_var = "x", id_var = "id") plot_subject(fit, subject_id = "19") # }
Run the code above in your browser using DataLab