Description Usage Arguments Details Value See Also Examples
View source: R/effectiveness.R
Function to evaluate the effectiveness of measures to reduce traffic accidents.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
accidents |
Either an R date/time or character vector with accident dates. For character vectors, only the following date formats are allowed: '2014-04-22', '2014/04/22', '22.4.2014'. |
measure_start |
The date when the implementation of the measure started (e.g. character '22.4.2014' or R date/time). |
measure_end |
The date when the implementation of the measure was terminated (respectively first day after the measure finished). If there is a period of acclimatization until road users have become accustomed to the new traffic regime, this can or should be integrated here. |
exposition |
Optional data frame with exposition data. The first column is the time value, the second column the exposure. If the time value is a specific date (e.g. '22.4.2014'), this is considered as the start date of this exposure. If the time value is a year (format '2010') the exposure is taken for the whole year. Exposure values are extended until a new entry is available. If necessary, the first exposure value is extended backwards. DEFAULT NULL. |
from |
From which date or year (1.1.) the time series should be considered. Optional. If not specified, the 1.1 from the year of the earliest accident is used. |
until |
Until what date or year (31.12) the time series should be considered. Optional. If not specified, the 31.12 from the year of the latest accident is used. |
main |
Optional title for the plot. |
x_axis |
Optional, points at which tick-marks are to be drawn. |
max_y |
Optional maximum value for the y-axis. |
min_y |
Optional minimum value for the y-axis, defaults to 0. |
orientation_x |
Alignment of the labels of the x-axis; "v" for vertical, "h" for horizontal, by default horizontal alignment is selected for 8 years or less. |
add_exp |
Option to supplement the output plot with the exposure as an additional axis. Furthermore an additional plot of the exposure alone is produced. Only active if exposure is available. |
KI_plot |
TRUE/FALSE, indicating if an additional illustration with the 95% confidence interval for the measure effect is produced (only of limited use for models without measure effect). |
lang |
Language for output ("en", "fr", "de" or "it"), defaults to "en". |
Traffic accident counts (or rates) before and after the implementation of a traffic measure are analyzed to evaluate the effect of the measure. Since accidents are count data, they are modelled using count regression methods, by default a Poisson model. However, the fit is tested for overdispersion and in case of significant overdispersion the model is automatically replaced by a Negative Binomial model. For flexibly making justice to the specific situation, six different scenarios for the effect of the measure are evaluated using different model formulations: no effect, trend, measure effect, trend effect, measure effect and trend, measure and trend effect. The most suitable mopdel is chosen via AIC, displayed in a plot and commented in printed output. Optionally, traffic exposure can be provided, resulting in the analysis of accident rates. The measure effect evaluates the difference directly before and directly after the measure. An important assumption in the analysis is that the decision for traffic measures happens independently of the observed number of accidents. Accident numbers are random variables that fluctuate. If a measure is taken due to a randomly increased number of accidents, this leads to an overestimation of the effect of the measure in the analysis, since in such cases a decrease in the number of accidents can be expected even without a measure (regression-to-the-mean phenomenon). This is particularly problematic for site-specific measures with small accident numbers. Ideally, only observations from the period after the decision to implement a measure should be considered in the effectiveness analysis. In practice however, this often proves difficult because measures are implemented quickly and the remaining time series very short.
A specific R object (class_effectiveness
) is generated as function output. The main object is the plot with a graphical analysis of the measures' effect. The function print.class_effectiveness()
extracts the most important key figures of the analysis.
Specifically, the output contains a list of the following elements:
|
Output of the selected count regression model (Poisson or Negative Binomial family. |
|
Selected model scenario. |
|
Prepared data that were used for the analysis. |
|
p-value of the positive measure effect, if it exists. |
|
p-value of the interaction term, if it exists. |
|
p-value of the deviance dispersion test. |
|
Plot graphical analysis (ggplot-class). |
|
Additional illustration with the 95% confidence interval for the measure effect (ggplot-class). |
|
Overlapping of the confidence intervals before and after the measure. |
|
Selected language. |
|
Addional plot of the exposition, if available (ggplot-class). |
effectiveness_multiple()
for the joint analysis of a measure that was implemented at several locations.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ex1 <- effectiveness(accidents = example_no_effect, measure_start = '1.1.2011', measure_end = '1.1.2011')
print(ex1)
plot(ex1)
plot_ci(ex1)
summary(ex1)
ex2 <- effectiveness(accidents = example_measure_effect, measure_start = '1.1.2012', measure_end = '1.1.2012')
ex2
ex3 <- effectiveness(accidents = example_measure_and_trend_effect, measure_start = '2011-01-01', measure_end = '2011-1-1')
plot(ex3)
ex4 <- effectiveness(accidents = example_measure_effect_and_trend, measure_start = '2012/01/01', measure_end = '2012/1/1')
ex4
ex5 <- effectiveness(accidents = example_trend, measure_start = '1.1.2013', measure_end = '1.1.2013')
print(ex5)
ex6 <- effectiveness(accidents = example_trend_effect, measure_start = '1.1.2011', measure_end = '1.1.2011', lang = "fr")
print(ex6)
ex7 <- effectiveness(accidents = example_no_effect, measure_start = '1.1.2011', measure_end = '1.1.2011', exposition = exposition_ex1, lang = "de")
summary(ex7)
plot(ex7)
ex8 <- effectiveness(accidents = example_measure_effect, measure_start = '1.1.2012', measure_end = '1.4.2012', exposition = exposition_ex2, add_exp = TRUE, lang = "it")
plot(ex8)
plot(ex8$plot_exposition)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.