Learn R Programming

prodest (version 1.0.2)

lagPanel: Generate lagged input variables

Description

Function to generate lagged variables in a panel.

Usage

lagPanel(idvar, timevar, value)

Arguments

idvar

vector of panel identifiers.

timevar

vector of time identifiers.

value

numeric vector, matrix or data frame containing the variable or variables to be lagged.

Author

Gabriele Rovigatti

Details

lagPanel() accepts panel identifiers, numeric time identifiers and one or more variables to be lagged. It returns a vector for vector input and a matrix for matrix or data-frame input. Observations without a corresponding value at \(t-1\) are returned as NA. The combination of idvar and timevar must uniquely identify observations.