Convenience wrapper that runs the full event study pipeline: prepare data, fit models, and calculate test statistics in a single call.
Usage
run_event_study(
task,
parameter_set = ParameterSet$new(),
report = FALSE,
report_args = list(),
verbose = getOption("eventstudy.verbose", TRUE)
)Arguments
- task
An EventStudyTask object.
- parameter_set
A ParameterSet object defining the event study. Defaults to a new ParameterSet with default settings.
- report
Logical. When
FALSE(default), the function behaves exactly as before this parameter was added. WhenTRUE, also renders a report viaes_report()after the pipeline completes and attaches the rendered path(s) asattr(task, "report_path").- report_args
Named list forwarded to
es_report()whenreport = TRUE. May includeoutput_file,format,provider, and any other argument accepted byes_report(). Defaults tolist()(useses_report()defaults, which render"event_study_report.html"in the working directory).- verbose
Logical; if FALSE, suppress informational messages. Default
getOption("eventstudy.verbose", TRUE).
Value
The task object with all results computed. When report = TRUE,
the returned task additionally carries attr(task, "report_path")
with the path(s) of the rendered report file(s). The return type is always
a fitted EventStudyTask in both paths.
See also
prepare_event_study, fit_model,
calculate_statistics, MarketModel,
ARTTest
Other eventstudy-pipeline:
EventStudyTask,
ParameterSet,
calculate_statistics(),
fit_model(),
prepare_event_study()
Examples
# \donttest{
data(dieselgate)
task <- EventStudyTask$new(dieselgate$firm, dieselgate$index, dieselgate$request)
# Run the pipeline and render a report to a temporary directory
out <- file.path(tempdir(), "event_study_report.html")
task <- run_event_study(task, ParameterSet$new(), report = TRUE,
report_args = list(output_file = out))
#> Report mode: Offline rule-based narrative
#> Report generated: /tmp/RtmpE2WNJT/event_study_report.html
#> Report written to: /tmp/RtmpE2WNJT/event_study_report.html
attr(task, "report_path") # path to the rendered HTML
#> html
#> "/tmp/RtmpE2WNJT/event_study_report.html"
# }
