Toeplitz Calculations
toepl_fwd.RdMultiplication of stacked data vector with a block Toeplitz matrix (toepl_fwd() for MA calculations) or
"inversion" of a block Toeplitz matrix in order to perform calculations equivalent to
multiplying a given stacked data vector with the inverse of a lower-triangular banded block Toeplitz matrix (toepl_inv() for AR calculations).
Note that matrix polynomials can be mapped one-to-one to banded lower-triangular block Toeplitz matrices.
Arguments
- polm_wide
Wide matrix \(( d_0, d_1, \ldots, d_q )\) of dimension \((m \times (q+1) n)\) which represents a matrix polynomial \(d(z)\) of degree \(q\).
- data_in
Data matrix of dimension \((dim(inputs) x nobs)\). Every column corresponds to one observation.
- t0
Integer. Time index where calculations should start. Default set to 1. For AR calculations, \(degree + 1\) would be another smart option.
- polm_rev
Wide matrix \((c_p, ... , c_1)\) of dimension \((n \times (q+1) n)\) with coefficients ordered in reverse direction, and zero-lag coefficient matrix not included. It represents a square polynomial matrix \(c(z)\) with \(c_0\) equal to the identity matrix and of degree \(p\).
MA-type Toeplitz calculations
Given a polynomial matrix of degree \(q\) and dimension \((m \times n)\), where \(m \geq n\), and given a "wide" input data matrix of dimension \((n \times nobs)\), where \(nobs\) is the number of observations such that each column corresponds to one observation and the number of columns is equal to the number of observations, we calculate a "wide" output data matrix of dimension \((m \times nobs)\).
The function name toepl_fwd stems from the multiplication of the "stacked" input data vector
\((u_1', \ldots , u_{nobs}')'\) with a banded lower-triangular block Toeplitz matrix \(T\)
of dimension \((nobs m \times nobs n)\)
whose block elements depend only on the difference between the row- and column-index
such that \(T_{i,j} = d_{i-j}\).
AR-type Toeplitz calcuations
Given a square polynomial matrix \(c(z)\) for which \(c_0\) is the identity matrix and given
a wide data matrix y = data_in, obtain the solution u, a wide data matrix, of the Toeplitz equation
$$T (y_1', \ldots , y_{nobs}')' = (u_1', ... , u_{nobs}')'$$
Note that the zero-lag coefficient is discarded and the coefficients are in reversed order since this simplifies computations and implementation.
Examples
p = test_polm(dim = c(2,2), degree = 2) %>% unclass()
dim(p) = c(2,2*3)
data = matrix(rnorm(2*100), 2, 100)
toepl_fwd(p, data)
#> [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]
#> [1,] 510.2124 591.722 550.9224 -14.64333 60.00184 68.7352 23.30945 -150.9463
#> [2,] 947.0918 1089.146 993.8233 -55.56036 88.12579 108.2333 31.40229 -291.1333
#> [,9] [,10] [,11] [,12] [,13] [,14] [,15]
#> [1,] -0.4696408 -21.53957 -70.85923 -448.3449 -600.5447 -383.1017 -36.90036
#> [2,] -5.6852431 -58.85437 -150.07499 -846.5205 -1122.3008 -715.5857 -76.36098
#> [,16] [,17] [,18] [,19] [,20] [,21] [,22]
#> [1,] 370.0041 144.9023 239.8477 -76.46756 53.72312 -342.3163 -255.5162
#> [2,] 678.2381 270.9223 447.6972 -141.97984 92.17225 -635.6517 -474.4878
#> [,23] [,24] [,25] [,26] [,27] [,28] [,29]
#> [1,] -103.8851 0.7209543 44.03768 -194.9453 -223.0306 -276.4654 -188.7679
#> [2,] -191.2661 3.7731678 86.93303 -354.7262 -415.9734 -514.2577 -342.7457
#> [,30] [,31] [,32] [,33] [,34] [,35] [,36]
#> [1,] 100.3126 -68.14199 -186.2020 -448.3576 -168.1526 -20.84882 112.7147
#> [2,] 195.8020 -121.75222 -341.7005 -823.3767 -314.6987 -41.68026 206.7740
#> [,37] [,38] [,39] [,40] [,41] [,42] [,43] [,44]
#> [1,] 341.9386 230.8940 140.0042 -35.47138 131.6846 363.1961 186.4942 -31.21823
#> [2,] 641.8679 433.6764 262.4417 -68.40544 253.7337 670.5589 352.3534 -60.29550
#> [,45] [,46] [,47] [,48] [,49] [,50] [,51]
#> [1,] -125.8485 -212.5876 -76.94024 18.59178 404.6596 391.5683 132.1309
#> [2,] -227.3964 -408.5210 -160.34136 25.55094 743.0450 729.3120 245.1671
#> [,52] [,53] [,54] [,55] [,56] [,57] [,58] [,59]
#> [1,] 256.9471 60.1798 196.9165 -119.7090 2.165670 14.16877 54.87276 446.4558
#> [2,] 483.2944 119.9496 365.0681 -220.3207 4.274539 37.17679 129.62789 858.2814
#> [,60] [,61] [,62] [,63] [,64] [,65] [,66] [,67]
#> [1,] 590.182 626.1492 576.4109 329.0421 341.5009 89.66096 231.7741 248.6255
#> [2,] 1116.163 1176.0537 1068.0539 601.5399 615.8724 157.59599 428.3118 476.1102
#> [,68] [,69] [,70] [,71] [,72] [,73] [,74] [,75]
#> [1,] 395.0349 320.8353 371.5064 103.6782 497.1447 369.9901 503.5129 -69.07115
#> [2,] 750.2104 620.7921 682.7332 194.2454 906.6085 687.9507 932.7265 -116.78077
#> [,76] [,77] [,78] [,79] [,80] [,81] [,82]
#> [1,] 79.10943 -58.53831 49.87025 -0.6814087 6.932149 132.3772 -10.35951
#> [2,] 144.80076 -113.08518 75.72281 0.7666597 1.744034 231.0682 -44.62924
#> [,83] [,84] [,85] [,86] [,87] [,88] [,89]
#> [1,] -68.29832 -324.4736 -488.9333 -383.5725 -296.2645 7.586234 212.1663
#> [2,] -145.24835 -615.5804 -911.3451 -710.4349 -545.4499 8.777912 379.0434
#> [,90] [,91] [,92] [,93] [,94] [,95] [,96]
#> [1,] 266.2046 291.5513 263.7207 554.184 355.4840 -204.8022 -519.1205
#> [2,] 466.5306 523.8199 486.9680 1030.368 664.0207 -385.6751 -965.4407
#> [,97] [,98] [,99] [,100]
#> [1,] -568.7417 -49.75446 96.54684 625.7832
#> [2,] -1050.4450 -78.87944 194.23520 1168.0893
p = test_polm(dim = c(2,2), degree = 2) %>% unclass()
dim(p) = c(2,2*3)
data = matrix(rnorm(2*100), 2, 100)
toepl_inv(p, data)
#> [,1] [,2] [,3] [,4] [,5] [,6]
#> [1,] 0.2594184 -59.40114 20186.59 -6781597 2278439670 -7.654954e+11
#> [2,] 0.2489178 -111.42057 37218.99 -12505124 4201388282 -1.411555e+12
#> [,7] [,8] [,9] [,10] [,11]
#> [1,] 2.571862e+14 -8.640776e+16 2.903072e+19 -9.753554e+21 3.276936e+24
#> [2,] 4.742452e+14 -1.593338e+17 5.353195e+19 -1.798532e+22 6.042592e+24
#> [,12] [,13] [,14] [,15] [,16]
#> [1,] -1.100964e+27 3.698947e+29 -1.242748e+32 4.175305e+34 -1.402792e+37
#> [2,] -2.030151e+27 6.820770e+29 -2.291598e+32 7.699163e+34 -2.586715e+37
#> [,17] [,18] [,19] [,20] [,21]
#> [1,] 4.713010e+39 -1.583447e+42 5.319962e+44 -1.787366e+47 6.005078e+49
#> [2,] 8.690678e+39 -2.919838e+42 9.809883e+44 -3.295861e+47 1.107322e+50
#> [,22] [,23] [,24] [,25] [,26]
#> [1,] -2.017547e+52 6.778425e+54 -2.277371e+57 7.651365e+59 -2.570656e+62
#> [2,] -3.720309e+52 1.249925e+55 -4.199419e+57 1.410893e+60 -4.740229e+62
#> [,27] [,28] [,29] [,30] [,31]
#> [1,] 8.636725e+64 -2.901711e+67 9.748981e+69 -3.275400e+72 1.100448e+75
#> [2,] 1.592591e+65 -5.350686e+67 1.797689e+70 -6.039759e+72 2.029199e+75
#> [,32] [,33] [,34] [,35] [,36]
#> [1,] -3.697213e+77 1.242166e+80 -4.173348e+82 1.402134e+85 -4.710800e+87
#> [2,] -6.817572e+77 2.290524e+80 -7.695553e+82 2.585502e+85 -8.686604e+87
#> [,37] [,38] [,39] [,40] [,41]
#> [1,] 1.582704e+90 -5.317468e+92 1.786528e+95 -6.002263e+97 2.016601e+100
#> [2,] 2.918469e+90 -9.805283e+92 3.294316e+95 -1.106803e+98 3.718565e+100
#> [,42] [,43] [,44] [,45] [,46]
#> [1,] -6.775247e+102 2.276304e+105 -7.647778e+107 2.569451e+110 -8.632675e+112
#> [2,] -1.249339e+103 4.197450e+105 -1.410232e+108 4.738006e+110 -1.591845e+113
#> [,47] [,48] [,49] [,50] [,51]
#> [1,] 2.900350e+115 -9.744410e+117 3.273864e+120 -1.099932e+123 3.695479e+125
#> [2,] 5.348177e+115 -1.796846e+118 6.036927e+120 -2.028248e+123 6.814375e+125
#> [,52] [,53] [,54] [,55] [,56]
#> [1,] -1.241583e+128 4.171391e+130 -1.401477e+133 4.708592e+135 -1.581962e+138
#> [2,] -2.289450e+128 7.691945e+130 -2.584290e+133 8.682531e+135 -2.917101e+138
#> [,57] [,58] [,59] [,60] [,61]
#> [1,] 5.314974e+140 -1.785691e+143 5.999448e+145 -2.015656e+148 6.772070e+150
#> [2,] 9.800686e+140 -3.292771e+143 1.106284e+146 -3.716821e+148 1.248754e+151
#> [,62] [,63] [,64] [,65] [,66]
#> [1,] -2.275236e+153 7.644192e+155 -2.568246e+158 8.628628e+160 -2.898991e+163
#> [2,] -4.195482e+153 1.409571e+156 -4.735785e+158 1.591098e+161 -5.345670e+163
#> [,67] [,68] [,69] [,70] [,71]
#> [1,] 9.739841e+165 -3.272329e+168 1.099416e+171 -3.693747e+173 1.241001e+176
#> [2,] 1.796004e+166 -6.034096e+168 2.027297e+171 -6.811181e+173 2.288376e+176
#> [,72] [,73] [,74] [,75] [,76]
#> [1,] -4.169435e+178 1.400820e+181 -4.706384e+183 1.581221e+186 -5.312483e+188
#> [2,] -7.688339e+178 2.583078e+181 -8.678460e+183 2.915733e+186 -9.796091e+188
#> [,77] [,78] [,79] [,80] [,81]
#> [1,] 1.784854e+191 -5.996636e+193 2.014711e+196 -6.768895e+198 2.274170e+201
#> [2,] 3.291227e+191 -1.105765e+194 3.715079e+196 -1.248168e+199 4.193515e+201
#> [,82] [,83] [,84] [,85] [,86]
#> [1,] -7.640608e+203 2.567042e+206 -8.624582e+208 2.897631e+211 -9.735275e+213
#> [2,] -1.408910e+204 4.733565e+206 -1.590352e+209 5.343163e+211 -1.795161e+214
#> [,87] [,88] [,89] [,90] [,91]
#> [1,] 3.270795e+216 -1.098900e+219 3.692015e+221 -1.240419e+224 4.167480e+226
#> [2,] 6.031267e+216 -2.026346e+219 6.807987e+221 -2.287304e+224 7.684734e+226
#> [,92] [,93] [,94] [,95] [,96]
#> [1,] -1.400163e+229 4.704178e+231 -1.580479e+234 5.309992e+236 -1.784017e+239
#> [2,] -2.581867e+229 8.674391e+231 -2.914366e+234 9.791498e+236 -3.289684e+239
#> [,97] [,98] [,99] [,100]
#> [1,] 5.993824e+241 -2.013766e+244 6.765722e+246 -2.273103e+249
#> [2,] 1.105247e+242 -3.713337e+244 1.247583e+247 -4.191549e+249