The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
For each post-event period, the method compares the observed mean outcome with the mean that would have been observed for that period’s target population had the event not occurred. The window-average estimand gives equal weight to each forecast period, not to each respondent across the pooled window.
An event being unanticipated is not enough. A causal interpretation requires, among other design-specific conditions:
The time-invariant before/after model is a special case with a
constant counterfactual. eventsurvey instead makes a local
linear extrapolation explicit and empirically examines comparable
pre-event forecasts.
The package supports estimand-specific calibration for respondent data, summary data, and covariate-adjusted models. Calibration is performed for each daily effect; period averages are formed only after that step.
For estimand-specific calibration, every candidate fitting window
contains s successive observed pre-event periods. Let the
final fitting period be f and the target dates be
t[1], ..., t[s]. Translate the elapsed offsets
t - f to the end of each candidate fit. Retain the window
only if all translated forecast dates are observed
before the event. Use these common complete windows for all daily
calibrations; additional origins that could forecast only earlier days
are not used in this release. Window selection depends on dates, not
outcome values.
With consecutive daily observations and an excluded Day 0, the final
fit ends on Day -1, so the elapsed horizons for Days 1 through
s are 2 through s + 1. This
preserves the event-day gap in every placebo exercise. With
event_day = "include", the elapsed horizons are 1 through
s. On sparse schedules the actual offsets are matched,
rather than treating the first, second, and later observed forecast
periods as equal calendar horizons. Fitting spans and respondent
composition can still differ across windows; the bias restriction must
be credible for those differences. If no complete matching window
exists, estimation stops with an explanation.
schedule = "consecutive" requires uninterrupted calendar
periods. The minimum of 2s + 1 observed pre-event periods
(2s when Day 0 is included) remains an interface
requirement; sparse surveys may need more history.
Let \(b_{jh}\) be the population signed forecast error at elapsed horizon \(h\) in placebo window \(j\), and \(b_h^{post}\) the corresponding population error in the no-event extrapolation after the event. All errors use observed minus predicted outcomes. The daily restriction is
\[ |b_h^{post}| \leq \max_j |b_{jh}|. \]
For an average over \(D\) specified post-event days, define
\[ \bar\tau_D=\frac{1}{D}\sum_{d=1}^D E[Y_i(1,d)-Y_i(0,d)],\qquad \widehat{\bar\tau}_D=\frac{1}{D}\sum_{d=1}^D\widehat\tau_d. \]
Calibrate each day first. The resulting bound on average population bias is
\[ |\bar b^{post}|\leq\frac{1}{D}\sum_{d=1}^D B_d,\qquad B_d=\max_j|b_{j,h_d}|. \]
Its sample counterpart is
estimate$bias_bound = mean(daily_bias_bounds). Do
not average signed prediction errors across days before
calibration. Each daily restriction must hold; a bound on
average bias alone is insufficient for this procedure. Small observed
errors do not establish these assumptions. Choose target dates and
models without selecting for a significant result.
For example, to estimate the mean effect over Days 1–5:
library(eventsurvey)
fit_five <- eventsurvey(y ~ day, sample_data,
window = 5,
event_day = "exclude", schedule = "consecutive"
)
fit_five$estimate
#> effect std_error conventional_low conventional_high bias_bound conf_low
#> 1 0.1389318 0.397998 -0.64113 0.9189936 0.7943862 -2.106989
#> conf_high n_windows n_reference
#> 1 2.366161 20 100This fits Days -5 through -1 and targets Days 1 through 5. On a
sparse survey, window = 5 with the default observed
schedule means the first five observed periods, which need not be the
first five calendar days.
reference retains individual errors and elapsed
horizons. days includes sampling standard errors, bias
bounds, and counts of matching references.
average_components contains all target days and the more
conservative daily intervals used for aggregation, including an included
but hidden event day. estimate$n_reference counts the daily
reference contrasts across all targets.
For any one scalar target \(\theta\), let the effect estimator have population limit \(\eta=\theta+b\). Let \(\delta_j\) denote its selected population reference contrasts: matching-horizon errors for that daily target. Assume
\[ |b|\leq B,\qquad B=\max_j|\delta_j|. \]
For every reference \(j\) and sign \(q\in\{-1,1\}\), calculate
\[ \widehat v_{jq}=\widehat{\operatorname{Var}}(\widehat\theta) +\widehat{\operatorname{Var}}(\widehat\delta_j) +2q\widehat{\operatorname{Cov}}(\widehat\theta,\widehat\delta_j). \]
The interval endpoints are
\[ L=\min_{j,q}\left[\widehat\theta+q\widehat\delta_j -z_{1-\alpha/2}\sqrt{\widehat v_{jq}}\right],\qquad U=\max_{j,q}\left[\widehat\theta+q\widehat\delta_j +z_{1-\alpha/2}\sqrt{\widehat v_{jq}}\right]. \]
Here is the coverage argument for the extension. Select a population reference \(j^*\) attaining \(B\) and signs giving \(\eta-B\) and \(\eta+B\). The assumed bound implies \(\eta-B\leq\theta\leq\eta+B\). A valid one-sided lower confidence limit for the first quantity fails with probability at most \(\alpha/2\); a valid one-sided upper limit for the second fails with probability at most \(\alpha/2\). The implemented minimum is no larger than that lower limit and the implemented maximum is no smaller than that upper limit. The union bound therefore gives coverage at least \(1-\alpha\). The proof uses population maximizers, not whichever error happens to be largest in the sample, so it also covers ties. It does not require independent placebo windows or an additional multiplicity correction across references.
This adapts the union–intersection logic of Kolesár and Rothe (2018), rather than asserting that their regression-discontinuity theorem directly covers this survey estimator. For Gaussian independent period means with known variances, the linear-contrast argument is finite-sample. The package substitutes estimated variances (and estimated influence functions with covariates), so its reported intervals are asymptotic. The justification requires a fixed finite set of dates/references, sufficient observations per period, a joint central limit theorem, consistent covariance estimates, and nondegenerate relevant contrast variances. A uniform coverage claim additionally requires those regularity conditions uniformly over the specified model class. Arbitrary serially correlated period shocks are not covered by the current independent-respondent covariance estimator.
The ordinary daily intervals use significance level \(\alpha\) and have pointwise coverage. They are not a simultaneous band.
For the average honest interval, recompute each daily interval \([L_d,U_d]\) at significance level \(\alpha/D\). By Bonferroni, all \(D\) intervals jointly cover their daily effects with probability at least \(1-\alpha\) asymptotically. Therefore the interval
\[ \left[\frac{1}{D}\sum_d L_d,\;\frac{1}{D}\sum_d U_d\right] \]
covers the equal-day average with at least that probability. This is
a conservative construction that permits dependence between daily
estimators. The package does not average ordinary
pointwise 95% endpoints and label that a 95% average interval. With five
days and alpha = 0.05, the component intervals use 99%
coverage. This adjustment is across target days; the daily
union–intersection envelope needs no additional adjustment across
references.
The average estimator’s sampling variance is
\[ \widehat{\operatorname{Var}}(\widehat{\bar\tau}_D) =\frac{1}{D^2}\left\{\sum_d\widehat{\operatorname{Var}}(\widehat\tau_d) +2\sum_{d<e}\widehat{\operatorname{Cov}}(\widehat\tau_d,\widehat\tau_e)\right\}. \]
The standard error is its square root. It reduces to the sum of daily
variances divided by \(D^2\) only when
cross-day covariances are zero. Different post-event respondents do not
imply independent effect estimates: every day uses the same estimated
pre-event trend. The package retains this covariance in
inference$day_covariance, ordered as
fitted$relative_period. This standard error produces the
conventional interval; the honest interval uses the daily calibration
and aggregation described above.
For a time-only linear model, respondent-level OLS is equivalent to weighted least squares on period means with sample sizes as weights. Daily effects and reference errors are linear combinations of independent period means. Their coefficient rows determine the covariance matrix, including overlap between rolling windows and the final fitting window.
With additive covariates, each window fits respondent-level OLS and
predictions are averaged over respondents in each forecast period.
Influence contributions include coefficient uncertainty and the forecast
period’s outcome and covariate means. Scores are centered within period,
conditional on counts, with the correction n / (n - 1).
Their cross-products give daily and reference covariances; no
average-reference error is constructed for calibration.
Cross-products retain dependencies from shared respondents across fits and forecasts. This assumes independent respondents within and across periods; it permits heterogeneous variances but is not cluster-robust inference for repeated respondents or random common period shocks. The point estimator and reference errors must also satisfy the stated population bias restriction. See Covariate Adjustment for model requirements.
The procedure does not prove event exogeneity, repair event-caused changes in survey participation, or protect against a no-event path that departs more sharply than any matched pre-event forecast. It quantifies a transparent class of extrapolation errors; it does not replace design knowledge.
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.