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
#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 )