Commit 4c66a326 authored by François Févotte's avatar François Févotte

Meilleur intervalle de confiance pour les prédictions

parent 26cc1e49
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -613,15 +613,15 @@ négligeable. L'incertitude sur $\beta$ est en particulier de nature à engendre ...@@ -613,15 +613,15 @@ négligeable. L'incertitude sur $\beta$ est en particulier de nature à engendre
une perte de prédictibilité du modèle en temps long. une perte de prédictibilité du modèle en temps long.
```julia; echo=false; results="raw" ```julia; echo=false; results="raw"
data.theta_pred = predict(model, data) pred = predict(model, data, interval=:prediction, level=0.95)
data.theta_pred = pred.prediction
data.theta_pred1 = pred.prediction .- pred.lower
data.theta_pred2 = pred.upper .- pred.prediction
plot(xlabel="Date", ylabel="CO2 [ppm]") plot(xlabel="Date", ylabel="CO2 [ppm]")
plot!(data_raw.date, data_raw.co2, label="mesures") plot!(data_raw.date, data_raw.co2, label="mesures")
plot!(data.date, data.theta_pred, label="modèle theta", linewidth=3) plot!(data.date, data.theta_pred, label="modèle theta",
plot!(data.date, α .+ β1 * data.date_num .+ γ*data.date_num.^2, ribbon = (data.theta_pred1, data.theta_pred2))
linecolor="red", label="modèle theta (IC 95% sur beta)")
plot!(data.date, α .+ β2 * data.date_num .+ γ*data.date_num.^2,
linecolor="red", label=nothing)
disp() disp()
``` ```
...@@ -654,7 +654,11 @@ Le modèle `GLM` précédemment calibré est utilisé pour prédire $\theta(t)$. ...@@ -654,7 +654,11 @@ Le modèle `GLM` précédemment calibré est utilisé pour prédire $\theta(t)$.
ajoute la fonction de forme annuelle $\phi(t)$ par périodicité. ajoute la fonction de forme annuelle $\phi(t)$ par périodicité.
```julia; results="raw" ```julia; results="raw"
prediction.theta = predict(model, prediction) pred = predict(model, prediction, interval=:prediction, level=0.95)
prediction.theta = pred.prediction
prediction.theta1 = pred.prediction .- pred.lower
prediction.theta2 = pred.upper .- pred.prediction
prediction = join(prediction, avg, on=:day) prediction = join(prediction, avg, on=:day)
prediction.co2 = prediction.theta .+ prediction.phi_mean prediction.co2 = prediction.theta .+ prediction.phi_mean
...@@ -670,8 +674,10 @@ d'extrapolation ; on observe un décalage significatif et croissant ensuite. ...@@ -670,8 +674,10 @@ d'extrapolation ; on observe un décalage significatif et croissant ensuite.
idx = data_raw.date .> Date(lastyear) idx = data_raw.date .> Date(lastyear)
plot(xlabel="Date", ylabel="CO2 [ppm]") plot(xlabel="Date", ylabel="CO2 [ppm]")
plot!(data_raw.date[idx], data_raw.co2[idx], label="mesures") plot!(data_raw.date[idx], data_raw.co2[idx], label="mesures")
plot!(prediction.date, prediction.theta, label="tendance", linewidth=2) plot!(prediction.date, prediction.theta, label="tendance",
plot!(prediction.date, prediction.co2, label="prédiction", linewidth=2) linewidth=2,
ribbon = (prediction.theta1, prediction.theta2))
plot!(prediction.date, prediction.co2, label="prédiction", linewidth=2)
disp() disp()
``` ```
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment