effectiveness_multiple: Evaluation effectiveness of measures with data from multiple...

Description Usage Arguments Details Value See Also Examples

View source: R/effectiveness_multiple.R

Description

Function to evaluate the effectiveness of measures to reduce traffic accidents with data from multiple locations.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
effectiveness_multiple(
  accidents,
  measure_start,
  measure_end,
  exposition = NULL,
  from = NULL,
  until = NULL,
  main = NULL,
  max_y = NULL,
  min_y = NULL,
  orientation_x = NULL,
  add_exp = FALSE,
  KI_plot = FALSE,
  lang = "en"
)

Arguments

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

A vector with the dates (R date/time as well as character in '2014-04-22', '2014/04/22' or '22.4.2014 format) when the implementation of the measure started for each location. The vector must either be the same length as the number of elements in the accident-list or contain only one value. If only one value is given, it is used for all locations.

measure_end

A vector with the dates the implementation when the measure was finished for each location (first day after the measure). The vector must either be the same length as the number of elements in the accident-list or contain only one value. If only one value is given, it is used for all locations.

exposition

Optional list with data frames 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. If only one data frame is given, it is used for all locations. DEFAULT NULL.

from

Vector with dates or year (1.1.) from which the time series should be considered. Optional. If not specified, the 1.1 from the year of the earliest accident is used. Must be specified for none or all locations. If only one value is given, it is used for all locations.

until

Vector with dates or year (31.12) until which the time series should be considered. Optional. If not specified, the 31.12 from the year of the latest accident is used. Must be specified for none or all locations. If only one value is given, it is used for all locations.

main

Optional title for the plot.

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 additionally 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".

Details

Traffic accidents counts (or rates) before and after the implementation of a traffic measure at different locations are analyzed in aggregated form to evaluate the joint effect of the measure. The implementation of the measures does not have to take place simultaneously, the data is adjusted accordingly. Before and after the measure, only the time range that is available for all locations is taken into account. This means that the site with the shortest time series before the measure and the site with the shortest time series after the measure determine the length of the evaluation period. As in the function effectiveness() the count data are modelled using regression models. By default a Poisson model is used, but is tested for overdispersion and in case of significant overdispersion it is replaced with a Negative Binomial model. For the situation analysis, six different model scenarios for the measure are evaluated: no effect, trend, effect of measures, measure effect and trend, trend effect, measures and trend effect. The best model is displayed. Traffic volumes can optionally be added as exposure, in that case rate models will be fitted.

Value

A specific R object (class_effectiveness_multi) is generated as function output. The main object is the plot with a graphical analysis of the measures. The print.class_effectiveness_multi() is used to extract the most important key figures of the analysis. Specifically, the output contains a list of the following elements:

fit

Output of the selected count regression model (Poisson or Negative Binomial family.

modelname

Selected model.

data

Prepared data combined from the different locations that were used for the analysis.

pvalue_measure

p-value of the positive measure effect, if it exists.

pvalue_interaction

p-value of the interaction term, if it exists.

test_overdisp

p-value of the deviance dispersion test.

plot

Plot graphical analysis (ggplot-class).

plot_all

List with plots with the analysis of all the individuell locations. Can be visualized with the function plot_all().

cases

Number of analyzed locations.

cases_exp

Number of locations with exposition data.

plot_KI

Additional illustration with the 95% confidence interval for the measure effect (ggplot-class).

conf_limit

Overlapping of the confidence intervals before and after the measure.

lang

Selected language.

plot_exposition

Addional plot of the exposition, if available (ggplot-class).

See Also

effectiveness() for the analysis of a single measure.

Examples

1
2
3
4
5
6
7
  multi1 <- effectiveness_multiple(accidents = list(example_no_effect, example_measure_effect),
  measure_start = c('1.1.2011', '1.1.2012'), measure_end = c('1.1.2011', '1.1.2012'))
  print(multi1)
  multi2 <- effectiveness_multiple(accidents = list(example_no_effect, example_measure_effect),
  measure_start = c('1.1.2011', '1.1.2012'), measure_end = c('1.1.2011', '1.1.2012'), exposition = exposition_ex2)
  print(multi2)
  plot_all(multi2)

gioca77/SAAO documentation built on Nov. 22, 2020, 10:20 a.m.