The window controls how local the trend is and how far it is extrapolated. Short windows adapt to local movement but estimate the line from less data; long windows use more observations but impose linearity over a longer span. The main window-sensitivity examples use estimand-specific calibration.
library(eventsurvey)
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
dat <- sample_data
windows <- 3:7
fits <- lapply(windows, function(s) {
eventsurvey(y ~ day, dat, window = s)
})
sensitivity <- lapply(seq_along(fits), function(i) {
fits[[i]]$estimate |>
mutate(window = windows[i], .before = 1)
}) |>
bind_rows()
sensitivity |>
select(window, effect, bias_bound, conf_low, conf_high)
#> window effect bias_bound conf_low conf_high
#> 1 3 0.27874739 0.8777661 -2.534684 3.092179
#> 2 4 0.02621792 1.0196825 -2.678397 2.601203
#> 3 5 0.13893179 0.7943862 -2.106989 2.366161
#> 4 6 0.23383015 0.7864303 -1.848577 2.435285
#> 5 7 0.11255135 0.5203419 -1.657103 1.894142Changing the window changes the counterfactual, number of rolling exercises, bias bound, and sampling uncertainty. Interpret them jointly.
Useful prespecified checks include plausible window lengths, including versus excluding the event period, restrictions motivated by known fieldwork breaks, and outcomes or subgroups chosen before inspecting results. Do not select the window that produces the smallest p-value or narrowest interval.
Also see
- Methodology and Assumptions for how the window defines the fitting and forecasting exercise.
- Getting Started for the default analysis and report.
- Frequently Asked Questions for concise guidance on choosing and prespecifying the window.