# peacf: Periodic Autocorrelation Function In pear: Package for Periodic Autoregression Analysis

## Description

The periodic autocorrelation for a time series with period p may be defined as for period (m=1,...,p) and lag, l=1,2,... by r(m, l) = c(m, l)/sqrt(c(m, 0)*c(m-l, 0)) where c(m, l) is the periodic autocovariance defined by c(m, l) = sum(z[t] * z[t-l]) where the sum is over all data in period m. When p=1, peacf produces output which is equivalent to that produced by Splus function acf.

## Usage

 `1` ```peacf(z, lag.max, plot=TRUE) ```

## Arguments

 `z` a univariate time series object. Note that the period of z is given by attr(z, "tsp")[3]. Additional information about the time series can be provided in a title string by setting attr(z, "title") to the desired string. This title will then be displayed on the plot. Abbreviations for the periods may be provided in attr(z, "abb"). For example, to use the standard monthly abbreviations: attr(z, "abb")<-month.abb. These abbreviations will be used to aid one in interpreting the output. `lag.max` maximum lag, if missing default is 0.25*length(z)/p, where p = attr(z, "tsp")[3] `plot` if plot=TRUE, a plot of the periodic autocorrelations is produced.

## Details

The use of the periodic autocorrelation and its plot are discussed in McLeod (1994) and a portmanteau model adequacy test is developed therein. The periodicity test is discussed in McLeod (1993). For more details, see the references below.

## Value

a list is returned with the following components: means periodic means standard.deviations periodic standard deviations acf matrix of periodic autocorrelations benchmark.sd 1/sqrt(nyrs), nyrs=ceiling(length(z)/p) sub.lengths number of observations in each period period p = attr(z, "tsp")[3] title title = attr(z, "title") periodicity.test list: test for periodic correlation at lag 1 The components of this list are: Q1 = scalar value, the test statistic Q1.sl = signifiance level (upper tail) portmanteau.test list: portmanteau test at various lags The components of this list are: QM = matrix of portmanteau statistics for each period and lag QM.df = corresponding df of QM

## Side Effects

a plot may be produced if plot=TRUE

## References

Hipel, K.W. and McLeod, A.I. (1994) "Time Series Modelling of Water Resources and Environmental Systems" Elsevier, Amsterdam ISBN 0–444–89270–2. (1013 pages). McLeod, A.I. (1993), "Parsimony, Model Adequacy and Periodic Correlation in Time Series Forecasting", International Statistical Review, Vol. 61, No. 3, pp.387–393. McLeod, A.I. (1994), "Diagnostic Checking of Periodic Autoregression" Journal of Time Series Analysis, Vol. 15, No. 2, pp.221–233.

peacf.plot, pepacf, peplot, peboxplot, pear, acf, acf.plot

## Examples

 ```1 2``` ```data(Fraser) peacf(log(Fraser)) ```

### Example output

```\$means
[1] 6.802323 6.729229 6.701575 7.386260 8.465994 8.842811 8.602368 8.158366
[9] 7.758821 7.533656 7.319756 6.981944

\$standard.deviations
[1] 0.2644065 0.2569112 0.2744818 0.3637385 0.2291767 0.1758557 0.2064202
[8] 0.1995902 0.2177208 0.2800922 0.3102253 0.3031721

\$acf
lags
periods         lag 1       lag 2         lag 3        lag 4       lag 5
period 1  0.7605628  0.62781334  0.4785081562  0.399444644  0.17661097
period 2  0.7838946  0.56744455  0.5839466885  0.424682988  0.37215526
period 3  0.7607552  0.65286065  0.4225520556  0.454665697  0.29893674
period 4  0.5774642  0.36144104  0.4213526098  0.285934616  0.21419304
period 5  0.3203617  0.23758964  0.1845467328  0.214926812  0.14008272
period 6  0.2411732 -0.25065689  0.0795668857  0.118474978  0.09456793
period 7  0.6095068 -0.03167037 -0.1991385635  0.041008541  0.18859296
period 8  0.7765472  0.49895714 -0.0006171332 -0.152066032 -0.01738546
period 9  0.6880798  0.46788587  0.3688460259 -0.008776051 -0.13996665
period 10 0.6922460  0.34253115  0.3126389048  0.273584893 -0.03691188
period 11 0.6811214  0.44837594  0.2809547895  0.219228567  0.16769948
period 12 0.7625285  0.53863153  0.4387789530  0.179266095  0.12457609
lags
periods          lag 6      lag 7      lag 8      lag 9     lag 10     lag 11
period 1  0.13660222 0.16944162 0.06269180 0.05670052 0.12019546 0.13047584
period 2  0.21461752 0.12106743 0.13371361 0.13553223 0.15238960 0.21302776
period 3  0.29526459 0.14633782 0.09488440 0.17967449 0.15599336 0.16506708
period 4  0.13335429 0.18953781 0.09721975 0.07204521 0.14335089 0.04595685
period 5  0.05595161 0.04948945 0.05539409 0.02162948 0.12201415 0.31002916
period 6  0.08392808 0.24240643 0.24311612 0.04806462 0.11143392 0.08472541
period 7  0.16064079 0.13311051 0.21820459 0.08073770 0.03507679 0.18277433
period 8  0.22810334 0.10035739 0.10528346 0.21660781 0.12057986 0.07544637
period 9  0.08347589 0.28375896 0.13397926 0.17252609 0.23556833 0.18463735
period 10 0.01199360 0.16134329 0.25888831 0.20550367 0.16264973 0.21866971
period 11 0.10557517 0.15095225 0.24234106 0.26774014 0.23930645 0.16739872
period 12 0.10023991 0.22334476 0.08978525 0.09381379 0.14871342 0.10675805
lags
periods          lag 12       lag 13      lag 14       lag 15       lag 16
period 1  0.049455319  0.089232517  0.04335322  0.077114695  0.140282696
period 2  0.327804252  0.231618700  0.19104061  0.196854567  0.218024105
period 3  0.295577067  0.280404763  0.17519688  0.088432269  0.086179599
period 4  0.004271505  0.198384054  0.11759177  0.131683658  0.114607274
period 5  0.118450203 -0.234620975 -0.02490185 -0.021567902 -0.070902345
period 6  0.118363563 -0.006027259 -0.14595339 -0.029299173  0.157225203
period 7  0.153868629  0.028870972 -0.05790376 -0.177364733 -0.085811158
period 8  0.232977189  0.171541098  0.03875821  0.002776710 -0.139645970
period 9  0.141201719  0.117100327  0.11240910 -0.005549963  0.074465684
period 10 0.218647259  0.180272071  0.15227946  0.224600757 -0.002263883
period 11 0.199158185  0.175461323  0.18999489  0.129609617  0.166094149
period 12 0.149219929  0.091770314  0.11724368  0.179356115  0.021027990
lags
periods          lag 17      lag 18       lag 19       lag 20
period 1   0.09244696  0.11764486  0.104274822  0.252082540
period 2   0.17055676  0.08520229  0.157702069  0.176325018
period 3   0.14455326  0.13606276 -0.011466155 -0.017398013
period 4   0.13841436  0.07917652  0.135022580 -0.026378876
period 5  -0.10751993 -0.08619534 -0.205238460 -0.165789384
period 6   0.01085247 -0.04211419  0.019922399  0.028277957
period 7   0.09862085  0.01710679 -0.002822277 -0.005141135
period 8  -0.08697952  0.09437301  0.057698893 -0.035828107
period 9  -0.01157336  0.06295157  0.251669518  0.228956761
period 10  0.05798679  0.21507431  0.289823146  0.377964423
period 11  0.16270087  0.20784731  0.179953724  0.250192058
period 12  0.02730439  0.10004517  0.244679423  0.055016152

\$benchmark.sd
[1] 0.1125088

\$sub.lengths
[1] 78 78 79 79 79 79 79 79 79 79 79 79

\$period
[1] 12

\$title
[1] "Fraser River at Hope, mean monthly flow (cms),  1912.3-1991.12"

\$periodicity.test
\$periodicity.test\$Q1
[1] 413.8426

\$periodicity.test\$Q1.sl
[1] 0

\$portmanteau.test
\$portmanteau.test\$QM
[,1]      [,2]      [,3]      [,4]
[1,] 110.01158 115.46054 118.26778 127.59270
[2,] 125.50857 135.00505 157.56146 168.75634
[3,] 117.36989 131.30939 150.03778 153.86909
[4,]  60.90238  68.01549  73.82885  78.48846
[5,]  20.47729  22.39789  35.73090  43.31427
[6,]  11.87399  23.04682  26.54660  28.77465
[7,]  35.50314  43.38915  50.85643  52.25002
[8,]  69.15743  79.86792  87.25158  90.50027
[9,]  66.99880  82.15009  88.62415  98.65782
[10,]  60.86842  73.68416  89.92403 112.04591
[11,]  64.78689  82.29441  94.48628 109.86784
[12,]  87.82874  95.64255 102.71727 108.64554

\$portmanteau.test\$QM.df
[,1] [,2] [,3] [,4]
[1,]    5   10   15   20
[2,]    5   10   15   20
[3,]    5   10   15   20
[4,]    5   10   15   20
[5,]    5   10   15   20
[6,]    5   10   15   20
[7,]    5   10   15   20
[8,]    5   10   15   20
[9,]    5   10   15   20
[10,]    5   10   15   20
[11,]    5   10   15   20
[12,]    5   10   15   20

attr(,"type")
[1] "acf"
```

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