mhp_batch() applies mhp_filter() to every column of a matrix or data frame and returns one
long table, with the smoothing parameter of each series in an attribute. Series of different lengths can share
the matrix: leading and trailing missing values are dropped series by series.
Value
A data.table with the columns series, t, original, trend,
cycle and the attribute lambdas, a data.table with series, lambda and
gcv (as in version 0.1.0).
Author
Muhammad Yaseen (myaseen208@gmail.com)
Examples
data(us_macro)
X <- log(as.matrix(us_macro[, c("gdp", "consumption", "investment")]))
mb <-
mhp_batch(
X = X
, max_lambda = 100000
)
attr(x = mb, which = "lambdas")
#> series lambda gcv
#> <char> <int> <num>
#> 1: gdp 683 0.0002819926
#> 2: consumption 534 0.0001753795
#> 3: investment 1009 0.0063778004