Skip to contents

Fits the OU parameters (theta, mu, sigma) on daily counts (same OLS-on-first-differences as morie_tps_langevin_simulate), then evolves an initial gaussian density centred on the last observation by an explicit advection-diffusion finite-difference scheme with reflective boundaries on a grid spanning from 0 to 1.5 * max(counts) + 1.

Usage

morie_tps_fokker_planck_grid(df, ds_name = "?", n_grid = 64L, n_steps = 200L)

Arguments

df

A data.frame.

ds_name

Character label.

n_grid

Grid points (default 64).

n_steps

Time steps (default 200, each of length 0.05 days).

Value

A morie_rich_result list with theta, mu, sigma, grid, density, stationary_peak.

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_fokker_planck_grid(df, ds_name = "synthetic"))
if (!inherits(res, "try-error")) str(res, max.level = 1)
#> List of 5
#>  $ title         : chr "Fokker-Planck -- synthetic"
#>  $ call          : chr "morie_tps_fokker_planck_grid(df=<300r>, n_grid=64, n_steps=200)"
#>  $ summary_lines : list()
#>  $ warnings      : chr "only 0 timestamps"
#>  $ interpretation: chr "No analysis: at least 60 timestamps required."
#>  - attr(*, "class")= chr [1:3] "morie_tps_stochastic_result" "morie_rich_result" "list"