temporal_aggregation: Temporal aggregation of a time series

View source: R/hierarchy.R

temporal_aggregationR Documentation

Temporal aggregation of a time series

Description

Creates a list of aggregated time series from a time series of class ts.

Usage

temporal_aggregation(y, agg_levels = NULL)

Arguments

y

univariate time series of class ts.

agg_levels

user-selected list of aggregation levels.

Details

If agg_levels=NULL then agg_levels is automatically generated by taking all the factors of the time series frequency.

Value

A list of ts objects each containing the aggregates time series in the order defined by agg_levels.

See Also

get_reconc_matrices()

Examples


# Create a monthly count time series with 100 observations
y <- ts(data=stats::rpois(100,lambda = 2),frequency = 12)

# Create the aggregate time series according to agg_levels
y_agg <- temporal_aggregation(y,agg_levels = c(2,3,4,6,12))

# Show annual aggregate time series
print(y_agg$`f=1`)


bayesRecon documentation built on Sept. 11, 2024, 9:08 p.m.