-----r library(talweg) P = ${P} #première heure de prévision H = ${H} #dernière heure de prévision ts_data = read.csv(system.file("extdata","pm10_mesures_H_loc.csv", package="talweg")) exo_data = read.csv(system.file("extdata","meteo_extra_noNAs.csv", package="talweg")) data = getData(ts_data, exo_data) indices = seq(as.Date("2015-01-01"),as.Date("2015-12-31"),"days") -----r p1 = computeForecast(data, indices, "Neighbors", "Neighbors", predict_from=P, horizon=H, simtype="mix", local=FALSE) p2 = computeForecast(data, indices, "Neighbors", "Zero", predict_from=P, horizon=H, simtype="none", local=TRUE) p3 = computeForecast(data, indices, "Average", "LastValue", predict_from=P, horizon=H) p4 = computeForecast(data, indices, "Persistence", "LastValue", predict_from=P, horizon=H, same_day=TRUE) -----r e1 = computeError(data, p1, P, H) e2 = computeError(data, p2, P, H) e3 = computeError(data, p3, P, H) e4 = computeError(data, p4, P, H) options(repr.plot.width=9, repr.plot.height=7) plotError(list(e1, e4, e3, e2), cols=c(1,2,colors()[258],4), agg="month") # noir: Neighbors non-local (p1), bleu: Neighbors local (p2), # vert: moyenne (p3), rouge: persistence (p4)