scan_bayes_negbin_cpp | R Documentation |
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 )
counts |
An integer matrix (most recent timepoint in first row). |
baselines |
A matrix with positive entries (most recent timepoint in first row). |
zones |
An integer vector (all zones concatenated; locations indexed from 0 and up). |
zone_lengths |
An integer vector. |
outbreak_prob |
A scalar; the probability of an outbreak (at any time, any place). |
alpha_null |
A scalar; the shape parameter for the gamma distribution under the null hypothesis of no anomaly. |
beta_null |
A scalar; the scale parameter for the gamma distribution under the null hypothesis of no anomaly. |
alpha_alt |
A scalar; the shape parameter for the gamma distribution under the alternative hypothesis of an anomaly. |
beta_alt |
A scalar; the scale parameter for the gamma distribution under the alternative hypothesis of an anomaly. |
inc_values |
A vector of possible values for the increase in the mean (and variance) of an anomalous count. |
inc_probs |
A vector of the prior probabilities of each value in
|
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.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.