Kaplan-Meier inter-event recurrence on TPS by neighbourhood
Source:R/mrm_tps.R
mrm_tps_neighbourhood_recurrence_km.RdFor each HOOD_158 neighbourhood, sorts events chronologically and computes the gap (in days) between consecutive events. Returns the per-neighbourhood mean, median, and total gaps. No censoring is applied (every gap is observed).
Usage
mrm_tps_neighbourhood_recurrence_km(
data,
date_col = "OCC_DATE",
hood_col = "HOOD_158",
min_gap_days = 0
)Value
A data.frame with one row per neighbourhood, columns
hood, n_events, n_gaps, mean_gap_days, median_gap_days,
p25_gap_days, p75_gap_days.
Examples
if (FALSE) {
tps <- read.csv("Assault_Open_Data.csv")
mrm_tps_neighbourhood_recurrence_km(tps)
}