Closed raneameya closed 4 months ago
I'd also find this quite useful. Now I have to run a for loop through each series which defeats the utility of the fable(tools) library
Yes, this is now possible since length 1 variables used in the transformation of the response variable are now cached. So you can use feasts::guerrero(resp)
to calculate the optimal box-cox transformation parameter.
library(tsibble)
#>
#> Attaching package: 'tsibble'
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, union
library(fable)
#> Loading required package: fabletools
library(feasts)
UKLungDeaths <- as_tsibble(cbind(mdeaths, fdeaths))
m <- list()
m[['Untransformed']] <- UKLungDeaths %>% # This works
model(
E = ETS(value),
A = ARIMA(value),
T = THETA(value)
)
m[['Transformed']] <- UKLungDeaths %>% # Can this be made to work?
model(
E = ETS(box_cox(value, lambda = guerrero(value))),
A = ARIMA(box_cox(value, lambda = guerrero(value))),
T = THETA(box_cox(value, lambda = guerrero(value)))
)
m
#> $Untransformed
#> # A mable: 2 x 4
#> # Key: key [2]
#> key E A T
#> <chr> <model> <model> <model>
#> 1 fdeaths <ETS(M,N,M)> <ARIMA(0,0,0)(1,1,1)[12]> <THETA>
#> 2 mdeaths <ETS(M,A,A)> <ARIMA(2,0,0)(2,1,0)[12] w/ drift> <THETA>
#>
#> $Transformed
#> # A mable: 2 x 4
#> # Key: key [2]
#> key E A T
#> <chr> <model> <model> <model>
#> 1 fdeaths <ETS(A,N,A)> <ARIMA(0,0,1)(0,1,1)[12] w/ drift> <THETA>
#> 2 mdeaths <ETS(A,N,A)> <ARIMA(0,0,1)(1,1,1)[12] w/ drift> <THETA>
Created on 2024-03-02 with reprex v2.0.2
While dealing with keyed tsibbles that contain many time series, it is useful to compare the forecast (and distributional) accuracy across model specifications relying on untransformed vs transformed time series.
Consider the example below -
Can
m[['Transformed]]
be made to work?