Formula: a quasi-Poisson GLM with overdispersion fitted to the
reference baseline – the same calendar window in each of the previous
baseline_years years, plus/minus reference_window time
units – and a 2/3-power upper threshold at the current point.
Usage
Farsig(
counts,
baseline_years = 5,
reference_window = 3,
period = 52,
alpha = 0.005,
reweight = TRUE,
trend = TRUE
)Arguments
- counts
Full count series; the LAST element is the point tested.
- baseline_years
Number of previous years b in the baseline.
- reference_window
Half-width w around each anniversary.
- period
Observations per year (52 for weekly data).
- alpha
Two-sided level for the threshold.
- reweight
Apply the Anscombe-residual re-weighting pass.
- trend
Include the linear time trend.
Value
List with estimate, observed, expected,
threshold, alarm, phi, phi_raw,
trend_coef,
score, nbaseline, n, method.
Details
With log mu_i = alpha + beta t_i, dispersion phi = max(1, sum w_i (y_i - mu_i)^2 / mu_i / (n - p)), prediction mu0 and its response-scale standard error se0, the threshold is (Farrington et al 1996 sec. 2.3)
tau = phi + se0^2 / mu0
se = sqrt(4/9 mu0^(1/3) tau)
U = (mu0^(2/3) + z_{1-alpha/2} se)^(3/2)
and an alarm is raised when the current count exceeds U. When
reweight is set the fit is repeated with Farrington weights
from standardised Anscombe residuals
a_i = 1.5 (y^(2/3) mu^(-1/6) - mu^(1/2)) / sqrt(phi (1 - h_i)),
down-weighting past outbreaks by a_i^-2. Following Noufaily et al
(2013) the trend term is retained whether or not it is significant.
References
Farrington, Andrews, Beale & Catchpole (1996), JRSS-A 159(3):547-563, doi:10.2307/2983331; Noufaily, Enki, Farrington, Garthwaite, Andrews & Charlett (2013), Statistics in Medicine 32(7):1206-1222, doi:10.1002/sim.5595.
Examples
set.seed(1)
Farsig(rpois(300, 10))
#> $estimate
#> [1] 0.09317964
#>
#> $observed
#> [1] 10
#>
#> $expected
#> [1] 8.982152
#>
#> $threshold
#> [1] 19.90566
#>
#> $alarm
#> [1] 0
#>
#> $phi
#> [1] 1.085141
#>
#> $phi_raw
#> [1] 1.085141
#>
#> $trend_coef
#> [1] -7.524089e-06
#>
#> $score
#> [1] 0.09317964
#>
#> $nbaseline
#> [1] 35
#>
#> $n
#> [1] 300
#>
#> $method
#> [1] "Farrington flexible algorithm"
#>
#> attr(,"class")
#> [1] "morie_rich_result" "list"
