lags: Lag Index Combination

View source: R/lags.R

lagsR Documentation

Lag Index Combination

Description

Generates a data frame whose rows correspond to indexes showing the initial and final lag to be used in a regression as finite distributed lag model with two explanatory variables, for example. This function is useful as an intermediate step for constructing lag variables. See details.

Usage

lags(p, q, recursive = FALSE)

Arguments

p

Integer, maximum lag p.

q

Integer, maximum lag q.

recursive

Logical, FALSE or TRUE (see details).

Details

Condiser the following regression:

  • y_{i,t} = a_0 + y_{i,t-pstart} + ... + y_{i,t-pend} + x_{i,t-qstart} + ... + x_{i,t-qend} + e_{i,t}.

lags constructs a data frame with indexes pstar, pend, qstart and qend. This is an intermediate step for obtaining the variables to estimate a lot of possible models. If recursive = FALSE, both pstart and qstart are always = 1 and pend and qend grows from one to p and q, respectively. If recursive = TRUE, on the other hand, pstart and qstart also grows from one to p and q. This last case is appropriated if one wants to construct variables for estimating models with more combinations of lags. The cost of this option is that it is time-consuming in terms of computation.

Value

Data frame

Examples

lags(2, 1, recursive = FALSE)

nelson16silva/wavcoreinf documentation built on Feb. 17, 2025, 7:10 p.m.