Skip to contents

Counts incidents by month-of-year, day-of-week, and hour-of-day, then runs a chi-square goodness-of-fit test against a uniform distribution on each cycle.

Usage

morie_tps_seasonal_pattern(df, ds_name = "?")

Arguments

df

A data.frame.

ds_name

Character label.

Value

A morie_rich_result list with per-cycle counts and chi-square p-values.

Examples

set.seed(1)
df <- data.frame(OCC_YEAR = rep(2014:2023, each = 30),
                 OCC_MONTH = sample(month.name, 300, TRUE),
                 HOOD_158 = sample(sprintf("%03d", 1:20), 300, TRUE),
                 LAT_WGS84 = runif(300, 43.6, 43.8),
                 LONG_WGS84 = runif(300, -79.5, -79.2))
res <- try(morie_tps_seasonal_pattern(df, ds_name = "synthetic"))
if (!inherits(res, "try-error")) str(res, max.level = 1)
#> List of 9
#>  $ title         : chr "Seasonal / cyclic patterns -- synthetic"
#>  $ call          : chr "morie_tps_seasonal_pattern(df=<300r>)"
#>  $ summary_lines :List of 3
#>  $ warnings      : chr(0) 
#>  $ interpretation: chr "p < 0.05 in any cycle indicates incident times are NOT uniformly distributed over that cycle (e.g. weekday vs w"| __truncated__
#>  $ n             : int 300
#>  $ month         :List of 5
#>  $ dow           : NULL
#>  $ hour          : NULL
#>  - attr(*, "class")= chr [1:3] "morie_tps_temporal_result" "morie_rich_result" "list"