I try to find articles using R superlearner algo, and program it on a rolling or expanding window. There is “An Algorithmic Crystal Ball: Forecasts-based on Machine Learning” from the IMF. But no code provided by authors. I try with “Roll apply” function which works for one specific algo, but not for “ensemble” algo like superlearner. If you have any idea, or article related. Thanks for your help.
ok using “roll apply” for one specific algo, like “lm”
donnees <- data.frame(x = c(2, 10, 2, 3, 11, 14, 18, 20, 17, 1, 48, 58, 70, 48), y = c(3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 10, 2, 5,7))
print(donnees)
taille_fenetre <- 5
regression_glissante <- rollapply(donnees, width = taille_fenetre, FUN = function(z) coef(lm(y ~ x, data = as.data.frame(z))), by.column = FALSE, align = “right”)
but “roll apply” doesn’t work with “superlearner”
karl eychenne is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.