View source: R/lago_sensitivity.R
| plot.lago_sensitivity | R Documentation |
Draws the sensitivity curve with ggplot2.
By default (show = "cost") it plots the recommended cost against the swept
value as a line with points: for an "outcome_goal" sweep this is the
cost-of-stringency curve, and for a "cost_multiplier" sweep it is a
straight line. With show = "components" it instead plots the recommended
value of each intervention component against the swept value, one coloured
line per component. Rows with NA outputs are dropped with a message. The
runs whose goal could not be reached, so the shrinking method gave their
recommendation, are drawn as triangles, and a caption says so. A
sweep of period labels or dates is drawn on a discrete axis, in the order of
values.
## S3 method for class 'lago_sensitivity'
plot(x, show = c("cost", "components"), ...)
x |
A |
show |
One of |
... |
Ignored. |
A ggplot2 object, or NULL invisibly when
show = "components" and no components are recorded.
sens <- lago_sensitivity(
data = mtcars, outcome_name = "mpg", outcome_type = "continuous",
glm_family = "gaussian", link = "identity",
intervention_components = c("gear", "qsec"),
intervention_lower_bounds = c(0, 0),
intervention_upper_bounds = c(10, 350),
cost_list_of_vectors = list(c(0, 4), c(4, 6)),
outcome_goal_intention = "maximize",
parameter = "outcome_goal", values = c(30, 35, 40)
)
plot(sens)
plot(sens, show = "components")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.