Combine mutliple objects of persephone objects into a new hierachical persephone object. On the resulting time series the user can perform direct and indirect seasonal adjustments.
persephone::persephone
-> persephone::multipleTimeSeries
-> hierarchicalTimeSeries
components
the sub series of the hierarchical time series
weights
the weights used for aggregating components
indirect
wether to use direct or indirect adjustement
params
of all components and the aggregated series
paramsDirect
params of the aggregated series
adjustedIndirect
results from the indirect adjustment where all components are adjusted and then aggregated
adjusted
results from the seasonal adjustment
forecasts
get forecasts
forecastsIndirect
get forecasts according to indirect adjustments
new()
create a new hierarchical time series
hierarchicalTimeSeries$new(
...,
method = c("tramoseats", "x13"),
userdefined = NULL,
spec = NULL,
list = NULL,
weights = NULL
)
...
one or more objects which are either of class persephone or can be coerced to persephone objects with asPersephone. If more than one element is supplied, the underlying time series must have the same time instances. All elements supplied in ... must be named.
method
specifies the method to be used for the direct adjustment of the aggregate series. tramoseats or x13
userdefined
passed as the userdefined argument to tramoseats() or x13()
spec
a model specification returned by x13_spec() or tramoseats_spec()
list
a list of persephone objects as alternative input to ...
.
This argument can also handle mts objects
weights
either a vector if the same weight is used for all time points or a list of ts objects or a mts object if the weight varies for different time points. They must have the same length as the number of components.
setOptions()
sets options for all entries of the dependency tree recursively (if recursive = TRUE). See vignette("persephone-hierarchical") for more details.
iterate()
iterate over all components
fun
a function that takes a persephone object as a parameter
asTable
if true, the return value of this method will be coerced to a data.frame
component
the id of the component
unnest
if asTable = FALSE
, converts the return value from a
nested list into a flat list
this functin is similar to lapply()
in the sense that it
can be used to apply a function to several persephone objects
simultaniusely
updateParams()
change all or some parameters of components
fixOutlier()
fix the automatically detected outliers and the span to find new automatically detected outliers
component
character vector with names of the components for which the parameters should be changed. If NULL (default) the parameters of all components will be changed
timespan
number of months from the end of the time series where outliers are not fixed
verbose
if TRUE the changed parameters will be reported
generateQrTable()
Generate a table for the eurostat quality report
if (FALSE) {
objX13 <- perX13(AirPassengers, "RSA3")
ht <- perHts(a = objX13, b = objX13, method = "x13", spec = "RSA1")
ht$updateParams(easter.enabled = TRUE)
ht$updateParams(component = "a", usrdef.outliersEnabled = TRUE,
usrdef.outliersType = c("AO","LS","LS"),
usrdef.outliersDate=c("1950-01-01","1955-04-01","1959-10-01"))
ht$run()
ht$adjustedDirect
ht$adjustedIndirect
ht2 <- perHts(a = ht, b = objX13)
ht2$run()
ht2$adjustedDirect
ht2$adjustedIndirect
}
## ------------------------------------------------
## Method `hierarchicalTimeSeries$run`
## ------------------------------------------------
perX13(AirPassengers)$run()