tsaggr {MAPA} | R Documentation |
Non-overlapping temporal aggregation
Description
Non-overlapping temporal aggregation.
Usage
tsaggr(y,fout,fmean=c(FALSE,TRUE),outplot=c(FALSE,TRUE))
Arguments
y |
Time series vector (can be ts object). |
fout |
Vector containing desirable aggregation levels. Must be positive and integer. If larger than length(y) then it is ignored. |
fmean |
If TRUE the aggregated is done using mean, otherwise sum is used. |
outplot |
If TRUE a plot of the original series and the aggregated ones is produced. |
Value
out |
List of temporally aggregated series. If y was a ts object, then 'out' has ts objects with appropriate frequencies. Any non-integer frequency is set equal to 1. Series are named ALx, where x is the aggregation level. |
all |
An array containing all aggregated series in the original frequency. Series are named ALx, where x is the aggregation level. |
idx |
List of indices used to produce 'out' from 'all': y.out[[i]] <- y.all[y.idx[[i]],i]. Series are named ALx, where x is the aggregation level. |
Author(s)
Nikolaos Kourentzes, nikolaos@kourentzes.com.
Examples
out <- tsaggr(admissions,fout=2:12,fmean=TRUE,outplot=TRUE)