- # NOTE: if predict_at does not cut days at midnight,
- # for the exogenous to be synchronized they need to be shifted
- if (predict_at > 0)
- {
- exo_hat = as.data.frame(exo_df[max(1,i-1),(1+nb_exos+1):(1+2*nb_exos)])
- exo_Dm1 = if (i>=3) as.data.frame(exo_df[i-1,2:(1+nb_exos)]) else NA
- } else
- {
- exo_hat = as.data.frame(exo_df[i,(1+nb_exos+1):(1+2*nb_exos)])
- exo_Dm1 = if (i>=2) as.data.frame(exo_df[i-1,2:(1+nb_exos)]) else NA
- }
+ exo = as.data.frame( exo_df[i,2:(1+nb_exos)] )
+ exo_hat =
+ if (i < nrow(exo_df))
+ as.data.frame( exo_df[i+1,(1+nb_exos+1):(1+2*nb_exos)] )
+ else
+ NA #exogenous prediction for next day are useless on last day
+ data$append(time, serie, exo, exo_hat)
+ if (i >= limit)
+ break