Package 'tidydlnm'

Title: Wrapper Package for Tidy DLNM Output and Plots
Description: tidydlnm is a wrapper package that converts output from the dlnm package into more tidyverse-friendly tibbles and plots.
Authors: Erika Rasnick [aut, cre]
Maintainer: Erika Rasnick <[email protected]>
License: GPL (>= 3)
Version: 0.0.1
Built: 2024-11-23 02:47:36 UTC
Source: https://github.com/geomarker-io/tidydlnm

Help Index


get tibble of cumulative estimates at each lag

Description

get tibble of cumulative estimates at each lag

Usage

tidy_cumul_fits(cpred, call = rlang::caller_env())

Arguments

cpred

a crosspred object created from dlnm::crosspred()

call

used for error handling

Value

a tibble with columns for lag, estimate, se, and lower and upper 95% confidence bounds (one row per lag)


get tibble of estimates at each lag

Description

get tibble of estimates at each lag

Usage

tidy_lag_fits(cpred, call = rlang::caller_env())

Arguments

cpred

a crosspred object created from dlnm::crosspred()

call

used for error handling

Value

a tibble with columns for lag, estimate, se, and lower and upper 95% confidence bounds (one row per lag)


plot estimate at each lag and confidence intervals using ggplot2

Description

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


get tibble of overall effect estimates

Description

get tibble of overall effect estimates

Usage

tidy_overall_fit(cpred, call = rlang::caller_env())

Arguments

cpred

a crosspred object created from dlnm::crosspred()

call

used for error handling

Value

a tibble with columns for estimate, se, and lower and upper 95% confidence bounds (1 row)


get tibble detailing each window of association with summary statistics

Description

get tibble detailing each window of association with summary statistics

Usage

tidy_window_summary(lag_fits)

Arguments

lag_fits

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

Value

a tibble containing windows defined by starting and ending lags, window length, maximum absolute effect estimate, and the lag at which that maximum occurs