Hi,
A question based on
quantile_ensemble_talk/ensembles_NYCR_2020.Rmd at master · robjhyndman/quantile_ensemble_talk · GitHub
library(fpp3)
library(distributional)
cafe <- readRDS("cafe.rds")
auscafe <- cafe %>%
summarise(turnover = sum(turnover))
e <- auscafe %>%
filter(year(date) <= 2018) %>%
model(ETS = ETS(turnover),
ARIMA = ARIMA(turnover ~
pdq(d=1) + PDQ(D=1))
) %>%
forecast(h = "1 year") %>%
summarise(
turnover = dist_mixture(
turnover[1], turnover[2],
weights=c(0.5,0.5)),
.mean = mean(turnover)
) %>%
mutate(.model = "ENSEMBLE")
e
I can extract the mean forecast, i.e. including .mean, but how do I extract sigma (sd) of the forecast from the Ensemble? If I include
.sd = sd(turnover)
I get the following error
Error in `summarise()`:
! Problem while computing `.sd = sd(turnover)`.
ℹ The error occurred in group 1: date = 2019 Jan.
Caused by error in `as.double()`:
! Can't convert `x` <distribution> to <double>.
Run `e]8;;rstudio:run:rlang::last_error()rlang::last_error()e]8;;` to see where the error occurred.
The reason being I want to calculate the log-predictive density score.
many thanks,
Amarjit