Hallo,
I have been trying for a long time to write a function that take rsplit Objects as Parameters, fits
ARIMAX Modells and gives predictions.
I would like to use future_map then.
Unfortunately, I can not achieve that.
My code so far is
grim_1<- read_excel(path, sheet= "2019")
head(grim_1)
grim_1 <- as.data.table(grim_1)
lg_id <- rep("GRIM_1", 8761)
grim_1 <- cbind(grim_1, lg_id)
head(grim_1)
tail(grim_1)
#---as_tsibble
my_data_tsbl <- as_tsibble(grim_1, key = lg_id, index = Datum_ab)
my_data_tsbl
#---rolling_origin
roll_eem_sliding <-rsample::rolling_origin(data=my_data_tsbl, initial = 365, assess= 120, skip = 120, cumulative = FALSE)
holdout_results_1 <- function(splits, ...) {
analysis_set <- analysis(splits)
mod <- analysis_set%>%
fable::ARIMA(Summe ~ Temp_Ist +
pdq(6,0,7) + PDQ(0,1,1, period= "day") )
# Get predictions on the other data
res <- broom::augment(mod, newdata = holdout)
res
}
ex<-holdout_results_1(roll_eem_sliding$splits[[1]])
#Error in match.arg(ic) : 'arg' must be NULL or a character vector
mod_form_1 <- as.formula(Summe ~ Temp_Ist + pdq(6,0,7) + PDQ(0,1,1, period= "day"))
ff_rolling_flex <- function(split, formula) {
split_for_data <- analysis(split)
ff_model <-split_for_data%>%
as_tsibble() %>%
fable::ARIMA(formula)
holdout <- assessment(split)
out <- broom::augment(ff_model, newdata = holdout)%>%
# calculate residuals for future use
mutate(.resid = Summe - .fitted)
# Return the test data set with the additional columns
out
}
ff_rolling_flex(roll_eem_sliding$splits[[1]], mod_form_1)
#Error in match.arg(ic) : 'arg' must be NULL or a character vector
I would like to kindl ask for help.
Best regards,
Kateryna