You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Section 9.4 Posterior Predictive Distributions in Regression Analysis
350
350
351
351
## Example 9.12: Road Safety Data; potential outcome analysis
352
-
We are now interested in predicting the number of children who would have been killed or seriously injured without the legal intervention on October 1, 1994.
353
-
To do so we reuse functions defined in Example 8.8.
352
+
353
+
We are now interested in predicting the number of children who would
354
+
have been killed or seriously injured without the legal intervention
355
+
on October 1, 1994. To do so we reuse functions defined in Example
Our goal is to predict the number of killed or seriously injured children
453
-
from October 1994 (i.e when the legal intervention giving priority to pedestrians became effective) using only data before that time point. Hence we estimate the model in Example 8.8. with an intercept and a holiday effect using only the information up to September 1994.
456
+
457
+
Our goal is to predict the number of killed or seriously injured
458
+
children from October 1994 onward (i.e., when the legal intervention
459
+
giving priority to pedestrians became effective) using only data
460
+
before that time point. Hence we estimate the model in Example
461
+
8.8. with an intercept and a holiday effect using only the information
plot(time(accidents), accidents[, "children_accidents"], type = "p", ylim = c(0, 7),
514
+
xlab = "", ylab = "",
515
+
main = "Number of children killed or seriously injured")
516
+
matplot(as.vector(time(e.pred)), pred.int, col = "blue", type = "l",
517
+
lty = c(2, 1, 2), lwd = 2, add = TRUE)
518
+
abline(v = 1994.75, col = "red")
510
519
```
511
520
512
-
We see that the prediction intervals after the intervention are much too wide which again indicates that there is an intervention effect. Note that whereas the risk
513
-
for a child to be killed or seriously injured in this model is constant the predicted mean number of killed and seriously injured children decreases from 1994 due to the decreasing number of exposed in that time period.
521
+
We see that the prediction intervals after the intervention are much
522
+
too wide which again indicates that there is an intervention
523
+
effect. Note that whereas the risk for a child to be killed or
524
+
seriously injured in this model is constant the predicted mean number
525
+
of killed and seriously injured children decreases from 1994 due to
526
+
the decreasing number of exposures in that time period.
514
527
515
528
# Section 9.5: Bayesian Forecasting of Time Series
516
529
517
530
## Example 9.13: US GDP data - one-step-ahead forecasting
518
531
519
-
For creating the design matrix for an AR model, we re-use the function from
520
-
Chapter 7.
532
+
For creating the design matrix for an AR model, we re-use the function
0 commit comments