Skip to contents

plot estimate at each lag and confidence intervals using ggplot2

Usage

tidy_lag_plot(
  lag_fits,
  continuous = TRUE,
  shading = FALSE,
  shade_colors = c("red", NA, "blue")
)

Arguments

lag_fits

tibble containing lag, estimate, and lower and upper bounds of confidence intervals; most likely output from [tidydlnm::tidy_lag_fits()``] or [tidydlnm::tidy_cumul_fits()``]

continuous

logical. When TRUE, creates a plot with ggplot2::geom_line() and ggplot2::geom_ribbon() (used when arglag is a continuous function). When FALSE, creates a plot with ggplot2::geom_pointrange() (used when arglag is not a continuous function -- eg, 'integer' or 'strata')

shading

logical. When TRUE, adds colored shading to the regions of the plot corresponding to significant associations as defined by the signSum variable of lag_fits

shade_colors

vector of three colors desired to shade the regions of negative, null, and positive association, respectively.

Value

a ggplot object