aggts | R Documentation |
Non-overlapping temporal aggregation of a time series according to a specific aggregation order.
aggts(y, agg_order, tew = "sum", align = "end", rm_na = FALSE)
y |
Univariate or multivariate time series: a vector/matrix or a |
agg_order |
A numeric vector with the aggregation orders to consider. |
tew |
A string specifying the type of temporal aggregation. Options include:
" |
align |
A string or a vector specifying the alignment of |
rm_na |
If |
A list of vectors or ts
objects.
Utilities:
FoReco2matrix()
,
balance_hierarchy()
,
commat()
,
csprojmat()
,
cstools()
,
ctprojmat()
,
cttools()
,
df2aggmat()
,
lcmat()
,
recoinfo()
,
res2matrix()
,
shrink_estim()
,
teprojmat()
,
tetools()
,
unbalance_hierarchy()
# Monthly time series (input vector)
y <- ts(rnorm(24), start = 2020, frequency = 12)
# Quarterly time series
x1 <- aggts(y, 3)
# Monthly, quarterly and annual time series
x2 <- aggts(y, c(1, 3, 12))
# All temporally aggregated time series
x3 <- aggts(y)
# Ragged data
y2 <- ts(rnorm(11), start = c(2020, 3), frequency = 4)
# Annual time series: start in 2021
x4 <- aggts(y2, 4, align = 3)
# Semi-annual (start in 2nd semester of 2020) and annual (start in 2021) time series
x5 <- aggts(y2, c(2, 4), align = c(1, 3))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.