TestStatisticBase: TestStatisticBase

TestStatisticBaseR Documentation

TestStatisticBase

Description

Base (abstract) class for single-event and multi-event test statistics. Subclass this to plug a custom test statistic into calculate_statistics() / run_event_study().

A subclass must implement compute(data_tbl, model):

  • data_tbl – a single event's rows with an abnormal_returns column already populated by the fitted model.

  • model – the fitted ModelBase (or list-mock) instance for that event; its statistics field carries sigma, degree_of_freedom, residuals and (since 2026-09-24) n_params.

compute() returns a tibble with the statistic's result columns for that event; multi-event subclasses (see R/multi_event_test_statistics.R) aggregate across all events in a group.

confidence_level and confidence_type are validated and stored at construction (confidence_type must be one of "two-sided" (default), "less" or "greater"); every p-value computed anywhere in EventStudy is currently two-sided, so a non-default confidence_type is accepted but ignored, with one warning at construction (A10, 2026-09-24).

Public fields

name

Short code of the test statistic.

confidence_level

The chosen confidence level.

confidence_type

Side of the test. One of "two-sided" (default), "less" or "greater". A10 (2026-09-24): every p-value computed anywhere in EventStudy is currently two-sided; a non-default value is validated but has NO effect on any computed statistic – it is stored and a one-time warning is emitted at construction. One-sided p-values are not implemented.

Methods

Public methods


TestStatisticBase$new()

Initializes the test statistic. This includes the confidence level and the type of the test ('less', greater' or 'two-sided')

Usage
TestStatisticBase$new(confidence_level = 0.95, confidence_type = "two-sided")
Arguments
confidence_level

The confidence level for the confidence band. Must be anumber between 0 and 1.

confidence_type

Side of the test statistic: "two-sided" (default), "less" or "greater". Every p-value in EventStudy is currently two-sided; supplying "less" or "greater" emits one warning that the value is stored but ignored by every compute() method.


TestStatisticBase$compute()

Computes the test test statistics for a single event.

Usage
TestStatisticBase$compute(data_tbl, model)
Arguments
data_tbl

The data for a single event with calculated abnormal returns.

model

The fitted model that includes the necessary information for calculating the test statistic.


TestStatisticBase$clone()

The objects of this class are cloneable with this method.

Usage
TestStatisticBase$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

See Also

Other eventstudy-statistics: ARTTest, BHARTTest, BMPTest, CARTTest, CSectTTest, CalendarTimePortfolioTest, GeneralizedSignTest, KolariPynnonenTest, MultiEventStatisticsSet, PatellZTest, RankTest, SignTest, SingleEventStatisticsSet, StatisticsSetBase, adjust_p_values(), bootstrap_test(), car_by_group(), car_quantiles(), cross_sectional_regression(), model_diagnostics(), pretrend_test(), simulate_event_study(), validate_task()


EventStudy documentation built on Oct. 31, 2026, 1:07 a.m.