}
# TODO: 7 == magic number
- if (simtype != "endo")
- {
- best_window_exo = optimize(
- errorOnLastNdays, c(0,7), simtype="exo")$minimum
- }
- if (simtype != "exo")
+ if (simtype=="endo" || simtype=="mix")
{
best_window_endo = optimize(
errorOnLastNdays, c(0,7), simtype="endo")$minimum
}
-
- if (simtype == "endo")
- {
- return (private$.predictShapeAux(data, fdays, today, horizon, local,
- best_window_endo, "endo", TRUE))
- }
- if (simtype == "exo")
+ if (simtype=="exo" || simtype=="mix")
{
- return (private$.predictShapeAux(data, fdays, today, horizon, local,
- best_window_exo, "exo", TRUE))
- }
- if (simtype == "mix")
- {
- return(private$.predictShapeAux(data, fdays, today, horizon, local,
- c(best_window_endo,best_window_exo), "mix", TRUE))
+ best_window_exo = optimize(
+ errorOnLastNdays, c(0,7), simtype="exo")$minimum
}
+
+ best_window =
+ if (simtype == "endo")
+ best_window_endo
+ else if (simtype == "exo")
+ best_window_exo
+ else if (simtype == "mix")
+ c(best_window_endo,best_window_exo)
+ else #none: value doesn't matter
+ 1
+
+ return(private$.predictShapeAux(data, fdays, today, horizon, local,
+ best_window, simtype, TRUE))
}
),
private = list(
window_endo
else if (simtype=="exo")
window_exo
- else #mix
+ else if (simtype=="mix")
c(window_endo,window_exo)
+ else #none
+ 1
}
return (prediction)