# pepsi: moving average expansion of a periodic autoregression In pear: Package for Periodic Autoregression Analysis

## Description

A periodic autoregression can be represented as an infinite periodic moving average process. This function calculates the coefficients in this expansion. These coefficients are needed in various time series computations such as in computing the variances of forecasts, variances of residual autocorrelations and theoretical autocovariances of a periodic autoregression. The function pepsi is used by pear to calculate the estimated standard deviations of the residual autocorrelations in a fitted periodic autoregression.

## Usage

 `1` ```pepsi(phi, lag.max) ```

## Arguments

 `phi` matrix with (i,j)-entry phi[i, j] where phi[i,j] is the autoregressive coefficient for period i at lag j. Here i=1,...,p and j=1,...,m where m is highest ar order specified. `lag.max` maximum number of lags to calculate in the moving average expansion.

## Details

The moving average expansion for a periodic autoregressive is defined in equation (1.4) of McLeod (1994) and the algorithm implements the recursion given in equation (1.5).

## Value

matrix with (i,j)-entry psi[i, j] where psi[i,j] is the autoregressive coefficient for period i at lag j. Here i=1,...,p and j=1,...,lag.max.

none

## References

McLeod, A.I. (1994), "Diagnostic Checking of Periodic Autoregression" Journal of Time Series Analysis, Vol. 15, No. 2, pp.221–233.

pear

## Examples

 ```1 2 3``` ```data(Fraser) pear.out <- pear(log(Fraser), ic="bic") pepsi(pear.out\$phi,lag.max=20) ```

### Example output

```           lags
periods         lag 1      lag 2       lag 3        lag 4       lag 5
period 1  0.6633120  0.4942948  0.37289514  0.432195529  0.07022041
period 2  0.7616731  0.5052269  0.37649104  0.284024192  0.32919171
period 3  0.8127845  0.6190761  0.41064063  0.306006089  0.23085047
period 4  0.7652456  0.6219798  0.47374527  0.314240938  0.23416982
period 5  0.2018468  0.1544623  0.12554460  0.095623945  0.06342851
period 6  0.2609638 -0.2076482  0.03951781  0.032119461  0.02446453
period 7  0.7691441  0.0298545 -0.19419975  0.004002795  0.00325341
period 8  0.7508529  0.5775140  0.02241633 -0.145815441  0.00300551
period 9  0.7505846  0.5635786  0.43347313  0.016825355 -0.10944682
period 10 1.1590270  0.1883114  0.50544298  0.388758466  0.01508975
period 11 0.7543983  0.8743680  0.14206180  0.381305314  0.29327872
period 12 0.7451919  0.5621715  0.65157197  0.105863311  0.28414565
lags
periods            lag 6        lag 7        lag 8         lag 9        lag 10
period 1   0.188477229  0.144966141  0.005626893 -0.0366022316  0.0007544357
period 2   0.053484996  0.143558034  0.110416809  0.0042858527 -0.0278789350
period 3   0.267561922  0.043471776  0.116681748  0.0897450732  0.0034834747
period 4   0.176657307  0.204750587  0.033266586  0.0892901954  0.0686770235
period 5   0.047266418  0.035657704  0.041328242  0.0067147525  0.0180229362
period 6   0.016227617  0.012092689  0.009122704  0.0105734602  0.0017179092
period 7   0.002478035  0.001643710  0.001224880  0.0009240471  0.0010709955
period 8   0.002442832  0.001860639  0.001234185  0.0009197044  0.0006938234
period 9   0.002255890  0.001833552  0.001396567  0.0009263599  0.0006903159
period 10 -0.098156902  0.002023185  0.001644413  0.0012525052  0.0008308018
period 11  0.011383678 -0.074049398  0.001526287  0.0012405424  0.0009448878
period 12  0.218548939  0.008483025 -0.055181015  0.0011373768  0.0009244422
lags
periods            lag 11        lag 12        lag 13        lag 14
period 1   0.0006131937  0.0004670531  3.098020e-04  2.308619e-04
period 2   0.0005746334  0.0004670531  3.557418e-04  2.359678e-04
period 3  -0.0226595667  0.0004670531  3.796135e-04  2.891414e-04
period 4   0.0026657137 -0.0173401340  3.574103e-04  2.904976e-04
period 5   0.0138622344  0.0005380657 -3.500050e-03  7.214212e-05
period 6   0.0046110067  0.0035465284  1.376593e-04 -8.954564e-04
period 7   0.0001740086  0.0004670531  3.592311e-04  1.394364e-05
period 8   0.0008041600  0.0001306549  3.506882e-04  2.697297e-04
period 9   0.0005207732  0.0006035901  9.806753e-05  2.632211e-04
period 10  0.0006191068  0.0004670531  5.413272e-04  8.795143e-05
period 11  0.0006267554  0.0004670531  3.523441e-04  4.083763e-04
period 12  0.0007041228  0.0004670531  3.480442e-04  2.625640e-04
lags
periods            lag 15        lag 16        lag 17        lag 18
period 1   1.741618e-04  2.018583e-04  3.279666e-05  8.802888e-05
period 2   1.758413e-04  1.326544e-04  1.537500e-04  2.498033e-05
period 3   1.917910e-04  1.429211e-04  1.078194e-04  1.249656e-04
period 4   2.212642e-04  1.467672e-04  1.093697e-04  8.250834e-05
period 5   5.863600e-05  4.466146e-05  2.962448e-05  2.207593e-05
period 6   1.845691e-05  1.500149e-05  1.142623e-05  7.579159e-06
period 7  -9.070160e-05  1.869518e-06  1.519515e-06  1.157374e-06
period 8   1.046962e-05 -6.810356e-05  1.403733e-06  1.140932e-06
period 9   2.024550e-04  7.858334e-06 -5.111748e-05  1.053620e-06
period 10  2.360687e-04  1.815709e-04  7.047712e-06 -4.584449e-05
period 11  6.635041e-05  1.780898e-04  1.369767e-04  5.316782e-06
period 12  3.043187e-04  4.944379e-05  1.327111e-04  1.020740e-04
lags
periods            lag 19        lag 20
period 1   6.770689e-05  2.628058e-06
period 2   6.704923e-05  5.157051e-05
period 3   2.030363e-05  5.449657e-05
period 4   9.562940e-05  1.553726e-05
period 5   1.665404e-05  1.930248e-05
period 6   5.647928e-06  4.260787e-06
period 7   7.677000e-07  5.720838e-07
period 8   8.690174e-07  5.764297e-07
period 9   8.563662e-07  6.522711e-07
period 10  9.449347e-07  7.680283e-07
period 11 -3.458500e-05  7.128571e-07
period 12  3.962023e-06 -2.577246e-05
```

pear documentation built on May 2, 2019, 9:16 a.m.