ret function

Returns a data.frame of sequential lag matrix.

Returns a data.frame of sequential lag matrix.

ret() is similar to embed(), but returns a data.frame specified with colnames, not matrix.

ret(wts, k)

Arguments

  • wts: Univariate time series.
  • k: k-1 lagged terms.

Details

ret() is similar to embed(), but returns a data.frame with colnames, not matrix. Moreover, unlike embed(),ret() fills lagged cells with NA, instead of trimming them.

Returns

A T by k dataframe returns. If you need 2 lags, you have to specify k=3, then it returns a dataframe with T by 3 dataframe, the first column is lag0.

References

Javier Lopez-de-Lacalle in https://github.com/cran/uroot/blob/master/R/hegy.R

Author(s)

Ho Tsung-wu tsungwu@ntnu.edu.tw, modifed from Javier Lopez-de-Lacalle

Examples

data(inf_Q) y=inf_Q[,2] ret(y,3)
  • Maintainer: Ho Tsung-wu
  • License: GPL (>= 2)
  • Last published: 2024-08-18

Useful links