plot_DLF: Plot Cumulative Effects

View source: R/plot_DLF.R

plot_DLFR Documentation

Plot Cumulative Effects

Description

Plot estimated cumulative effects from a DLIM object, can also compare estimated cumulative effects between a DLM and DLIM

Usage

plot_DLF(
  new_modifiers,
  mod_fit,
  mod_name,
  dlm_fit = NULL,
  plot_by,
  exposure_time = NULL,
  exp_time_unit = "Time",
  time_pts = NULL,
  mod_trans = NULL,
  link_trans = NULL
)

Arguments

new_modifiers

a vector of new modifier values for prediction (class "numeric")

mod_fit

DLIM model object (class "dlim")

mod_name

modifier name that follows variable name nomenclature (class "character")

dlm_fit

a list containing a crossbasis object from the dlnm package as the first element and a DLM model object as the second element (class "list")

plot_by

choose to create plots for particular modifier values, "modifier", or particular time points, "time", (class "character")

exposure_time

optional vector of exposure-time points if the first time point does not correspond to exposure-time 1. Must have the same length as the number of exposure-time points (class "numeric")

exp_time_unit

option to provide the unit for the exposure time points, e.g., "month" or "week". Only used with plot_by = "time" for labeling cross-sections (class "character")

time_pts

a subset of exposure-time points if plot_by = "time". Must be a subset of exposure_time points (class "numeric")

mod_trans

if modifiers are transformed, specify back transformation function (class "character")

link_trans

if family for glm is not Gaussian, specify back transformation to undo link function (class "character")

Value

This function returns a ggplot for point-wise effects isolated by either time points or modifier, including a DLM if specified

See Also

dlim

Type vignette('dlimOverview') for a detailed description.


dlim documentation built on June 10, 2025, 9:09 a.m.