ds: deseasonalize a time series

Description Usage Arguments Details Value Author(s) References Examples

Description

Deseasonalization method for monthly and annual

Usage

1
ds(z, Fm = 6, Fs = 6, type = c("daily", "monthly"), searchQ=TRUE, lag.max=20, ic=c("BIC","AIC"), standardizeQ=TRUE)

Arguments

z

vector or time series

Fm

Number of frequency components for the mean

Fs

Number of frequency components for the standard deviation

type

"daily" or "monthly"

searchQ

TRUE, search for best BIC/AIC model using harmonic reqressions of maximum orders Fm and Fs for seasonal means and standard deviations. If FALSE, just use input values.

lag.max

maximum order for the fitted autoregression

ic

"BIC" or "AIC" model selection

standardizeQ

TRUE, then subtract seasonal mean and divide by seasonal standard deviation. Otherwise, if FALSE, just subtract seasonal mean.

Details

See McLeod (2012) and Hipel and McLeod (1994) for further details and illustrative examples.

Value

When searchQ is TRUE, a list with two components is produced. The first component 'dspar' is the matrix whose rows are c(Fm, Fs, p, IC), where Fm and Fs are the number of Fourier components used for the mean and sd, p=AR order selected and IC is the value of the information criterion The second component is the deseasonalized time series. When searchQ is FALSE, just the deasonalized time series is returned.

Author(s)

A. I. McLeod (aimcleod@uwo.ca)

References

K. W. Hipel and A. I. McLeod (1994). Time Series Modelling of Water Resources and Environmental Systems. Elsevier.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
#Example 1. Simple example.
out <- ds(nottem, Fm=2, Fs=2, type="monthly")
summary(out)
#
#Example 2. longer example
## Not run: 
out <- ds(nottem, type="monthly")
#from the table below we see that 2 Fourier components are used for the seasonal means
# and 0 components for the seasonal standard deviations.
out$dispar
#check that the series is deasonalized using the cumulative periodogram test
cpgram(out$z)

## End(Not run)
#
#Example 3
#As a check, compute deaseasonalized time series using full transformation.
#Then monthly means should be close to 0 and monthly sd close to 1.0.
#But not exact due to harmonic regression errors.
z <- ds(nottem, Fm=6, Fs=6, type="monthly", searchQ=FALSE)$z
apply(matrix(z, ncol=12, byrow=TRUE), MARGIN=2, mean )
apply(matrix(z, ncol=12, byrow=TRUE), MARGIN=2, sd )

Example output

Loading required package: lattice
Loading required package: FitAR
Loading required package: leaps
Loading required package: ltsa
Loading required package: bestglm
  Fm Fs p      BIC Plausibility %
*  2  0 1 420.6258          100.0
   2  1 1 426.4091            5.5
NULL
 [1]  0.01555354  0.01075950  0.01878317 -0.02656415  0.04119409  0.04643533
 [7] -0.01317471  0.02121576 -0.01178098 -0.02363138 -0.02953174 -0.00457513
 [1] 1.029007 1.015959 1.036478 1.127363 1.059881 1.063405 1.019379 1.036789
 [9] 1.033774 1.079788 1.015934 1.014546

deseasonalize documentation built on May 2, 2019, 3:39 p.m.