Calculate the "Bayesian Spatial Scan Statistic" by Neill et al. (2006), adapted to a spatio-temporal setting. The scan statistic assumes that, given the relative risk, the data follows a Poisson distribution. The relative risk is in turn assigned a Gamma distribution prior, yielding a negative binomial marginal distribution for the counts.
scan_bayes_negbin_cpp(
counts,
baselines,
zones,
zone_lengths,
outbreak_prob,
alpha_null,
beta_null,
alpha_alt,
beta_alt,
inc_values,
inc_probs
)
A list with elements priors
(list), posteriors
(list),
and marginal_data_prob
(scalar). The list priors
has
elements
The prior probability of no anomaly.
The prior probability of an anomaly.
A vector (matrix with 1 row) of prior probabilities
of each value in the argument m_values
.
The prior probability of an outbreak in any of the space-time windows.
The list posteriors
has elements
The posterior probability of no anomaly.
The posterior probability of an anomaly.
A data frame with columns inc_values
and
inc_posterior
.
A data frame with columns zone
,
duration
, log_posterior
and
log_bayes_factor
, each row
corresponding to a space-time window.
A matrix with the posterior anomaly probability of each location-time combination.
A vector (matrix with 1 row) with the posterior probability of an anomaly at each location.
An integer matrix (most recent timepoint in first row).
A matrix with positive entries (most recent timepoint in first row).
An integer vector (all zones concatenated; locations indexed from 0 and up).
An integer vector.
A scalar; the probability of an outbreak (at any time, any place).
A scalar; the shape parameter for the gamma distribution under the null hypothesis of no anomaly.
A scalar; the scale parameter for the gamma distribution under the null hypothesis of no anomaly.
A scalar; the shape parameter for the gamma distribution under the alternative hypothesis of an anomaly.
A scalar; the scale parameter for the gamma distribution under the alternative hypothesis of an anomaly.
A vector of possible values for the increase in the mean (and variance) of an anomalous count.
A vector of the prior probabilities of each value in
inc_values
.