AnomaliesFiltersLags: Calculate anomalies, lags and rolling windows

Description Usage Arguments Value Author(s) See Also Examples

Description

This function computes several time-variant statisttics of a time series like seasonal anomalies, time lagged versions of time series, and filters time series based on running windows (using rollapply.

Usage

1
2
3
4
5
6
7
8
9
AnomaliesFiltersLags(x, 
    funSeasonalCycle = MeanSeasonalCycle, 
    funFilter = median, 
    alignFilter = c("center", 
        "left", "right"), 
    filters = c(3, 5, 
        7, 9, 11, 13), 
    lags = -1:-7, anom = TRUE, 
    ...)

Arguments

x

univariate time series of class ts

funSeasonalCycle

a function to estimate the seasonal cycle of the time series.

funFilter

a function to filter the time series based on rolling windows.

alignFilter

specifies whether the index of the running filter results should be left- or right-aligned or centered (default) compared to the rolling window of observations. See rollapply

filters

window sizes for rolling filters to be applied. If NULL, do not apply filters.

lags

time lags to be applied for lagged time series. If NULL, do not apply lags.

anom

compute seasonal anomalies?

...

further arguments (currently not used)

Value

The function returns a multivariate time series of class 'mts' with the following columns:

Author(s)

Matthias Forkel <matthias.forkel@tu-dresden.de> [aut, cre]

See Also

MeanSeasonalCycle

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
# do calculations
afl <- AnomaliesFiltersLags(ndvi)
summary(afl)

# seasonal anomalies
plot(afl[,"anom"]) 

# running median filters on original time series
plot(afl[, grep("orig.filter", colnames(afl))], plot.type="single", col=rainbow(6)) 

# running median filters on anomalies
plot(afl[, grep("anom.filter", colnames(afl))], plot.type="single", col=rainbow(6)) 

# lagged versions of original time series
plot(window(afl[, grep("orig.lag", colnames(afl))], start=c(1995, 1), 
   end=c(2000, 12)), plot.type="single", col=rainbow(7), type="l") 

# lagged versions of anomaly time series
plot(afl[, grep("anom.lag", colnames(afl))], plot.type="single", col=rainbow(7)) 

greenbrown documentation built on Dec. 18, 2020, 3:02 p.m.