dynformula {plm}R Documentation

Dynamic Formula

Description

A function to easily create a formula with lags and differences

Usage

dynformula(formula, lag.form = NULL, diff.form = NULL, log.form = NULL)

Arguments

formula

a formula,

lag.form

a list containing the lag structure of each variable in the formula,

diff.form

a vector (or a list) of logical values indicating whether variables should be differenced,

log.form

a vector (or a list) of logical values indicating whether variables should be in logarithms.

Details

lag.form is a list, diff.form and log.form are vectors (or lists) that should be of length equal to the total number of variables. Each element of these lists/vectors is:

It can also be an incomplete named list/vector (for example, to apply the transformation for only some variables) with eventually an unnamed element which then is the default value.

Value

An object of class c("dynformula", "formula"), which is a formula with four additional attributes: var, the names of the variables in the formula, lag, diff, and log, which store the information about lags, differences and logs, respectively.

A formula method coerces the dynformula object to a standard formula.

Author(s)

Yves Croissant

Examples

# all variables in log, x1, x2 and x3 laged twice, y laged once and x3 differenced
z <- dynformula(y ~ x1 + x2 + x3, lag.form = list(2, y = 1),
                diff.form = c(x3 = TRUE), log.form = TRUE)
formula(z)

[Package plm version 1.6-6 Index]