From: Benjamin Auder Date: Thu, 11 May 2017 15:05:24 +0000 (+0200) Subject: prepare report on one full year (2015) X-Git-Url: https://git.auder.net/images/assets/pieces/current/git-logo.png?a=commitdiff_plain;h=f71b975b140342f7ea80275359b7f4f9aa75153a;p=talweg.git prepare report on one full year (2015) --- diff --git a/pkg/R/utils.R b/pkg/R/utils.R index bc80030..7e4e332 100644 --- a/pkg/R/utils.R +++ b/pkg/R/utils.R @@ -113,8 +113,8 @@ getSimilarDaysIndices = function(index, data, limit, same_season, # .isSameSeason = function(month, month_ref) { - if (month_ref == 3) #TODO: same as Bruno (but weird) - return (month %in% c(2,3,4,9,10)) +# if (month_ref == 3) #TODO: same as Bruno (but weird) +# return (month %in% c(2,3,4,9,10)) if (month_ref %in% c(11,12,1,2)) #~= mid-polluted return (month %in% c(11,12,1,2)) if (month_ref %in% c(3,4,9,10)) #~= high-polluted diff --git a/reports/year2015.gj b/reports/year2015.gj new file mode 100644 index 0000000..63f8e41 --- /dev/null +++ b/reports/year2015.gj @@ -0,0 +1,51 @@ +-----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", NULL, + predict_from=P, horizon=H, simtype="none", local=TRUE) +p3 = computeForecast(data, indices, "Average", "Zero", + predict_from=P, horizon=H) +p4 = computeForecast(data, indices, "Persistence", "Zero", + 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)) + +# noir: Neighbors non-local (p1), bleu: Neighbors local (p2), +# vert: moyenne (p3), rouge: persistence (p4) + +## TODO: plot modifié, retourner jour par jour et agréger au mois + +## TODO: garder éventuellement ça :: +sum_p23 = e2$abs$indices + e3$abs$indices +i_np = which.min(sum_p23) #indice de jour "facile" +i_p = which.max(sum_p23) #indice de jour "difficile" +% if P == 8: +-----r +options(repr.plot.width=9, repr.plot.height=4) +par(mfrow=c(1,2)) + +plotPredReal(data, p1, i_np); title(paste("PredReal p1 day",i_np)) +plotPredReal(data, p1, i_p); title(paste("PredReal p1 day",i_p)) + +plotPredReal(data, p2, i_np); title(paste("PredReal p2 day",i_np)) +plotPredReal(data, p2, i_p); title(paste("PredReal p2 day",i_p)) + +# Bleu : prévue ; noir : réalisée (confondues jusqu'à predict_from-1)