Learn R Programming

tseffects: Dynamic Inferences from Time Series (with Interactions)

Autoregressive distributed lag (A[R]DL) models (and their reparameterized equivalent, the Generalized Error-Correction Model [GECM]) are the workhorse models in uncovering dynamic inferences. ADL models are simple to estimate; this is what makes them attractive. Once these models are estimated, what is less clear is how to uncover a rich set of dynamic inferences from these models. We provide tools for recovering those inferences. These tools apply to traditional time-series quantities of interest: especially instantaneous effects for any period and cumulative effects for any period (including the long-run effect). They also allow for a variety of shock histories to be applied to the independent variable (beyond just a one-time, one-unit increase) as well as the recovery of inferences in levels for shocks applies to (in)dependent variables in differences (what we call the Generalized Dynamic Response Function). These effects are also available for the general conditional dynamic model advocated by Warner, Vande Kamp, and Jordan (2026 doi:https://doi.org/10.1017/psrm.2026.10087). We also provide the actual formulae for these effects.

Two ultra-simple examples are shown below: see the vignette and manual for many, many more!

Installation

tseffects is available on CRAN. To install the stable version released to CRAN, install as normal:

install.packages("tseffects")
library(tseffects)

Usage: effects in levels

Drawing inferences from ADL and GECM models is easy. From an ADL(1,1), just specify the independent and dependent variables, as well as the treatment history desired.

# ADL(1,1)
# Use the toy data to run an ADL. No argument is made this is well specified; it is just expository
model <- lmodel.toydata <- lm(y ~ l_1_y + x + l_1_x, data = toy.ts.interaction.data)

GDRF.adl.plot(model = model.toydata, 
x.vrbl = c("x" = 0, "l_1_x" = 1), 
y.vrbl = c("l_1_y" = 1),
d.x = 0,
d.y = 0,
shock.history = "pulse", 
inferences.y = "levels",
inferences.x = "levels",
s.limit = 20)

Usage: conditional relationships

If we want to interpret the same style of effects from an interactive model, we just specify the interaction and its terms.

# ADL(1,1)
# Use the toy data to run an ADL. No argument is made this is well specified; it is just expository
model.toydata <- lm(y ~ l_1_y + x + l_1_x + z + l_1_z +
x_z + l_1_x_z +
x_l_1_z + l_1_x_l_1_z, data = toy.ts.interaction.data)

interact.adl.plot(model = model.toydata, x.vrbl = c("x" = 0, "l_1_x" = 1), y.vrbl = c("l_1_y" = 1), z.vrbl = c("z" = 0, "l_1_z" = 1),
x.z.vrbl = c("x_z" = 0, "l_1_x_z" = 1, "x_l_1_z" = 0, "l_1_x_l_1_z" = 1),
z.vals = -2:2,
effect.type = "impulse", plot.type = "lines", line.options = "z.lines",
s.limit = 20)

Copy Link

Version

Install

install.packages('tseffects')

Monthly Downloads

109

Version

0.2.1

License

GPL (>= 2)

Issues

Pull Requests

Stars

Forks

Maintainer

Soren Jordan

Last Published

February 5th, 2026

Functions in tseffects (0.2.1)

pulse.calculator

Generate pulse effect formulae for a given autoregressive distributed lag (ADL) model
toy.ts.interaction.data

Simulated interactive time series data
what.to.return

Do consistent dummy checks for functions (GDTE/GDRF) that use a GECM model
GDTE.adl.plot

Evaluate (and possibly plot) the General Dynamic Treatment Effect (GDTE) for an autoregressive distributed lag (ADL) model
general.calculator

Generate the generalized effect formulae for an autoregressive distributed lag (ADL) model, given pulse effects and shock/treatment history
adl.dummy.checks

Do consistent dummy checks for functions (GDTE/GDRF) that use an ADL model
approval

Data on US Presidential Approval
gecm.dummy.checks

Do consistent dummy checks for functions (GDTE/GDRF) that use a GECM model
GDRF.gecm.plot

Evaluate (and possibly plot) the General Dynamic Treatment Effect (GDRF) for a Generalized Error Correction Model (GECM)
interact.adl.plot

Plot the interaction in a single-equation time series model estimated via lm. It is imperative that you double-check you have referenced all x, y, z, and interaction terms through x.vrbl, y.vrbl, z.vrbl, and x.z.vrbl. You must also have their orders correctly entered. interact.adl.plot has no way of determining, from the variable list, which correspond with which
gecm.to.adl

Translate the coefficients from the General Error Correction Model (GECM) to the autoregressive distributed lag (ADL) model
GDRF.adl.plot

Evaluate (and possibly plot) the General Dynamic Response Function (GDRF) for an autoregressive distributed lag (ADL) model
GDTE.gecm.plot

Evaluate (and possibly plot) the General Dynamic Treatment Effect (GDTE) for a Generalized Error Correction Model (GECM)