mls: MIDAS lag structure

Description Usage Arguments Details Value Author(s) Examples

View source: R/midaslag.R

Description

Create a matrix of selected MIDAS lags

Usage

1
mls(x, k, m, ...)

Arguments

x

a vector

k

a vector of lag orders, zero denotes contemporaneous lag.

m

frequency ratio

...

further arguments used in fitting MIDAS regression

Details

The function checks whether high frequency data is complete, i.e. m must divide length(x).

Value

a matrix containing the lags

Author(s)

Virmantas Kvedaras, Vaidotas Zemlys

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Quarterly frequency data
x <- 1:16
## Create MIDAS lag for use with yearly data
mls(x,0:3,4)

## Do not use contemporaneous lag
mls(x,1:3,4)

## Compares with embed when m=1
embed(x,2)
mls(x,0:1,1)

Example output

Loading required package: sandwich
Loading required package: optimx
     X.0/m X.1/m X.2/m X.3/m
[1,]     4     3     2     1
[2,]     8     7     6     5
[3,]    12    11    10     9
[4,]    16    15    14    13
     X.1/m X.2/m X.3/m
[1,]     3     2     1
[2,]     7     6     5
[3,]    11    10     9
[4,]    15    14    13
      [,1] [,2]
 [1,]    2    1
 [2,]    3    2
 [3,]    4    3
 [4,]    5    4
 [5,]    6    5
 [6,]    7    6
 [7,]    8    7
 [8,]    9    8
 [9,]   10    9
[10,]   11   10
[11,]   12   11
[12,]   13   12
[13,]   14   13
[14,]   15   14
[15,]   16   15
      X.0/m X.1/m
 [1,]    NA    NA
 [2,]     2     1
 [3,]     3     2
 [4,]     4     3
 [5,]     5     4
 [6,]     6     5
 [7,]     7     6
 [8,]     8     7
 [9,]     9     8
[10,]    10     9
[11,]    11    10
[12,]    12    11
[13,]    13    12
[14,]    14    13
[15,]    15    14
[16,]    16    15

midasr documentation built on Feb. 23, 2021, 5:11 p.m.