Provides tools for estimating causal effects when an event occurs while a survey is in the field. The workflow models the unobserved no-event outcome path, evaluates short-horizon forecasts with rolling pre-event exercises, and reports inference that accounts for sampling uncertainty and bounded forecast misspecification.
eventsurvey estimates how survey outcomes change when an event occurs during
fieldwork. It learns the pre-event trend, projects what would have happened
without the event, and compares that counterfactual with the observed
post-event outcomes. The package provides estimates, uncertainty intervals,
automatic diagnostics, figures, and a shareable HTML report.
Install version 0.4.1, which uses daily estimand-specific calibration followed by aggregation for period averages:
install.packages("remotes")
remotes::install_github("yhoriuchi/eventsurvey", ref = "v0.4.1")
This command pins the installation to the v0.4.1 release for reproducibility.
Check your installed package version with packageVersion("eventsurvey").
The release badge links to the latest published release;
the website's navigation bar shows the version used to build its documentation.
library(eventsurvey)
fit <- eventsurvey(y ~ day, sample_data)
In sample_data, y is a five-category survey response coded from 1 (lowest)
to 5 (highest), and day is the interview day relative to the event: negative
values are before the event, 0 is the event day, and positive values are after
the event.
By default, the estimator excludes day 0 because respondents' exposure is
often unclear during the event period; forecasting begins on day 1.
Create a complete, self-contained HTML report with one additional command:
eventsurvey_report(fit)
The fitted object checks the data and design automatically, and the HTML report brings the main estimates, diagnostics, and figures together in one file.
Calibration matches each day's placebo errors to its elapsed forecast horizon. For a period average, the package calibrates each day first, then averages the estimates and bias bounds with equal day weights. It does not average signed prediction errors across days before calibration.
# Average effect over Days 1–5, excluding the event day
fit <- eventsurvey(y ~ day, sample_data, window = 5, schedule = "consecutive")
fit$estimate
fit$days
The average standard error includes covariance between daily estimates sharing
the pre-event regression. The average honest interval aggregates daily intervals
with a Bonferroni correction; displayed daily intervals remain pointwise.
Inspect fit$average_components for the intervals used in aggregation.
See Methodology for assumptions and inference.
With respondent-level data, put time first and add baseline characteristics:
adjusted <- eventsurvey(outcome ~ day + age + education, survey_data)
Numeric covariates enter linearly; factors and character columns enter as categorical indicators. Each pre-event window fits its own OLS model. Forecasts average predictions over each forecast period's respondents, and uncertainty includes estimated covariate means and overlapping fits. Use characteristics unaffected by the event, and assess forecasting performance before the event. See Covariate Adjustment for a runnable example, assumptions, and limitations. Summary-only data remain time-only.
Browse the complete article library or the function reference.
The current version estimates the effect of one event occurring during one survey fieldwork period. Future versions may extend the method to repeated events and to pooling comparable events across fieldwork periods—for example, designs studying multiple high-level visits. These extensions require new work on the estimand, dependence across events, and uncertainty.
Other potential features include alternative trend specifications, survey weights, clustered uncertainty, and richer workflows for multiple outcomes and subgroups. Each requires additional methodological development and validation before becoming a public package option.
Please check the existing GitHub issues. If your question or suggestion is not already covered, please open a new issue.