eventsurvey_summary() is the sufficient-statistics counterpart to
eventsurvey(). It is useful when respondent-level observations cannot be
redistributed but each period's count, mean, and sample variance are
available. For a time-only linear model, it produces the same estimates as
the respondent-level function.
Covariate adjustment is available only in eventsurvey(): period counts,
outcome means, and outcome variances do not contain the respondent-level
covariances needed to fit and quantify uncertainty in an adjusted model.
Arguments
- formula
A two-sided formula of the form
period_mean ~ time, using two untransformed column names.- data
A data frame or tibble with one row per observed period.
- n
The unquoted name of the column containing respondent counts. Defaults to a column named
n.- variance
The unquoted name of the column containing the within-period sample variance of the outcome. Defaults to a column named
variance. It may beNAwhennis one; the pooled within-period variance is then used for uncertainty calculations.- event_time
The event period, in the same scale and class as the time variable. Defaults to
0, which is appropriate when time is coded relative to the event. Supply the event date or period explicitly when using an absolute time scale.- window
Integer length of both the final pre-event fitting window and the post-event forecast horizon. Must be at least 2.
- event_day
Whether the event period is excluded so forecasting begins one period later (
"exclude", the default) or included in the forecast horizon ("include"). Exclusion is the safer default because exposure is often ambiguous for respondents interviewed during the event period.- report_event_day
If
FALSE, an included event period remains in the window-average estimate but is omitted from the printed day-specific results and plots. This argument applies only whenevent_day = "include".- alpha
Significance level for confidence intervals.
- schedule
How rolling fitting and forecasting windows are formed. The default,
"observed", forms fitting and forecasting windows from ordered periods containing responses and supports sparse survey schedules."consecutive"requires every period on the time scale to be represented. In either mode, models use the actual time values rather than compressing gaps.
Value
An object of class eventsurvey; see eventsurvey().
See also
vignette("summary-data", package = "eventsurvey") for a complete
period-level workflow and an equivalence demonstration.