
Run the full spatio-temporal consistency test
Source:R/test-spatio-properties.R
run_consistency_test.Rdrun_consistency_test() evaluates the temporal consistency of Local Moran's I cluster
classifications across multiple years. The input accident data can be either:
A single data.frame containing a
yearcolumn with multiple years of data.A list of
sfdata frames, each representing a separate year.
The function calculates Local Moran's I for each year and then tests the consistency of classifications over time.
Usage
run_consistency_test(
network_object,
accident_data,
dist_threshold = 1,
time_threshold = 2,
p_value_threshold = 0.05,
time_column = "time",
year_column = "year"
)Arguments
- network_object
A base network object, either
segmented_networkorspatiotemporal_network.- accident_data
Either:
A data.frame containing accident records for multiple years (must include a
yearcolumn).A list of
sfdata frames, one per year.
- dist_threshold
The spatial distance threshold for
calculate_local_moran.- time_threshold
The temporal distance threshold for
calculate_local_moran.- p_value_threshold
The p-value cutoff for the final consistency test.
- time_column
The name of the column in the accident data that contains the time information (e.g., "occurrence_hour"). Defaults to
"time".- year_column
The name of the column indicating the year in
accident_data(if data.frame). Defaults to"year".