plot_sensitivity: Generic Sensitivity Plot

View source: R/plot.R

plot_sensitivityR Documentation

Generic Sensitivity Plot

Description

This function draws a curve of indirect effect against the sensitivity parameter, allowing users to specify the name of x and y-axis variables using the x_var and y_var inputs.

Usage

plot_sensitivity(sensitivity_curve, x_var = "rho", y_var = "indirect_effect")

Arguments

sensitivity_curve

The output of a call to sensitivity or sensitivity_perturb. A data.frame whose columns are: outcome, {x_var}, {y_var}, and {y_var}_standard_error, where x_var and y_var are defined in the two arguments below.

x_var

The type of perturbation variable to plot along the x-axis. Defaults to "rho", following the sensitivity approach implemented in sensitivity_subset.

y_var

The type of effect to plot along the y-axis. Defaults to indirect_effect.

Value

A ggplot2 grob plotting the sensitivity parameter against the effect specified by y_var.

Examples

sensitivity_curve <- read.csv(url("https://go.wisc.edu/j2kvcj"))
plot_sensitivity(sensitivity_curve)

multimedia documentation built on Sept. 30, 2024, 9:28 a.m.