Functions to create lag values

Share:

Description

The function blag() creates a basis for lag values of x, (a matrix of lag values of x).
The function llag() creates a list with two components i) a basis matrix and ii) weights to be used as prior weights in any regression analysis. The function wlag() can take a "mlags" object (created by blag()) or a vector and returns a vector with ones and zeros. This can be used as prior weights in any analysis which uses blag().

Usage

Arguments

For blag() and llag() x is the vector for creating lags. For wlag() x is an mlags object created by blag().

lags

how many lags are required

from.lag

where the lags are starting from. The default values is zero which indicates that the x is also included as a first column. If you want x not to included in the matrix use from.lag=1

omit.na

if true the first "lag" rows of the resulting matrix are omitted

value

value : what values should be set in the beginning of the lags columns, by default is set to NA

...

additional arguments

Details

Those three functions are design for helping a user to fit regression model using lags by generating the appropriate structures.
The function blag() creates a basis for lag values of x. It assumed that time runs from the oldest to the newest observations. That is, the latest observations are the most recent ones. The function wlag() take a basis matrix of lags and creates a vector of weights which can be used as a prior weights for any regression type analysis which has the matrix as explanatory variable. The function llag() creates a list with the matrix base for lags and the appropriate weights.

Value

The function blag() returns a "mlags" object (matrix of lag values).
The function llag() returns a list with components:

matrix

The basis of the lag matrix

weights

The weights vector

The function wlag() returns a vector of prior weights having, The vector starts with zeros (as many as the number of lags) and continues with ones.

References

Stasinopoulos D. M., Rigby R.A. and Akantziliotou C. (2006) Instructions on how to use the GAMLSS package in R.
Accompanying documentation in the current GAMLSS help files, (see also http://www.gamlss.org/).