New answers tagged


What you appear to be doing is actually an auto-regressive (AR) model, so perhaps you can benefit from using existing models like ARIMA R already has great implementations for.


You need to assign each of the target variables to their own column and then train a model for each of your forecast horizons library(quantmod) symbol= getSymbols("AAPL",from="2010-03-01", auto.assign=F) close<-Cl(symbol) open<-Op(symbol) lc1<-lag(close) lc2<-lag(close,2) lc3<-lag(close,3) lo1<-lag(open) lo2<-lag(open,2) ...

Top 50 recent answers are included