Function to transform the matrix/vector of FoReco forecasts input and output into a list of time series/matrix/vector objects.

FoReco2ts(recf, m, ...)

FoReco2matrix(recf, m)

Arguments

recf

(\(h(k^\ast + m) \times 1\)) forecasts vector from thfrec, (\(h \times n\)) forecasts matrix from htsrec or (\(n \times h(k^\ast + m)\)) forecasts matrix from octrec, tcsrec, cstrec, iterec, ctbu.

m

Highest available sampling frequency per seasonal cycle (max. order of temporal aggregation, \(m\)), or a subset of \(p\) factors of \(m\).

...

optional arguments to ts (i.e. starting date); frequency is required only for the cross-sectional case.

Value

A list of class "ts" objects for FoReco2ts and a list of matrix/vector for FoReco2matrix

Examples

data(FoReco_data)
# Cross-temporal framework
oct_recf <- octrec(FoReco_data$base, m = 12, C = FoReco_data$C,
                   comb = "bdshr", res = FoReco_data$res)$recf
ts_oct <- FoReco2ts(recf = oct_recf, m = 12, start = c(15, 1))
mat_oct <- FoReco2matrix(recf = oct_recf, m = 12)

# Cross-sectional framework
# monthly base forecasts
mbase <- FoReco2matrix(FoReco_data$base, m = 12)$k1
# monthly residuals
mres <- FoReco2matrix(FoReco_data$res, m = 12)$k1
hts_recf <- htsrec(mbase, C = FoReco_data$C, comb = "shr", res = mres)$recf
ts_hts <- FoReco2ts(recf = hts_recf, start = c(15, 1), frequency = 12)
mat_hts <- FoReco2matrix(recf = hts_recf)

# Temporal framework
# top ts base forecasts ([lowest_freq' ...  highest_freq']')
topbase <- FoReco_data$base[1, ]
# top ts residuals ([lowest_freq' ...  highest_freq']')
topres <- FoReco_data$res[1, ]
thf_recf <- thfrec(topbase, m = 12, comb = "acov", res = topres)$recf
ts_thf <- FoReco2ts(recf = thf_recf, m = 12, start = c(15, 1))
mat_thf <- FoReco2matrix(recf = thf_recf, m = 12)