| ModelBase | R Documentation |
Base (abstract) class for return models used inside an
EventStudyTask. Each single event gets its own model instance, fitted on
that event's estimation-window data alone. Subclass this to plug a custom
return model into run_event_study() / fit_model().
A subclass must implement two methods:
fit(data_tbl) – fit the model on data_tbl (a single
event's rows, estimation and event window together) and populate
private$.statistics plus set private$.is_fitted.
abnormal_returns(data_tbl) – return data_tbl with an
abnormal_returns column added for the event window.
The statistics active binding exposes a named list consumed by the
test statistics layer. At minimum a subclass should populate:
sigma, degree_of_freedom, residuals,
forecast_error_corrected_sigma and
forecast_error_corrected_sigma_car. Since 2026-09-24, a model may
also set statistics$n_params (the number of parameters estimated
from the estimation window); PatellZTest reads this field for its
Q_i adjustment and falls back to 2 when a subclass does not report it.
Degenerate-input handling: subclasses that implement the shared contract
(see R/contract.R) read self$degenerate_mode,
self$event_id and self$firm_symbol, which are threaded onto
the cloned model instance by fit_model() before fit() is
called.
model_nameName of the model.
degenerate_modeResolved degenerate-input mode injected by fit_model() before fit() is called. Subclasses that implement the degenerate-input contract (MarketModel and Phase-2 models) read this field inside fit() via .resolve_degenerate_mode(self$degenerate_mode).
event_idEvent identifier threaded from the outer data_tbl row. Used in degenerate-input error/warning messages.
firm_symbolFirm identifier threaded from the outer data_tbl row. Used in degenerate-input error/warning messages.
statisticsRead-only field to get statistics.
modelRead-only field to get the fitted model.
is_fittedRead-only field to check if the model is fitted. Statistics object contains different model specific KPIs that describes the fitted model.
ModelBase$fit()Fits the model with given data.
ModelBase$fit(data_tbl)
data_tblA data frame or tibble containing the data to fit.
ModelBase$abnormal_returns()Calculate the abnormal returns with given data and fitted model.
ModelBase$abnormal_returns(data_tbl)
data_tblData frame or tibble containing the data to calculate abnormal returns.
ModelBase$clone()The objects of this class are cloneable with this method.
ModelBase$clone(deep = FALSE)
deepWhether to make a deep clone.
Other eventstudy-models:
BHARModel,
Carhart4FactorModel,
ComparisonPeriodMeanAdjustedModel,
DCCGARCHModel,
FamaFrench3FactorModel,
FamaFrench5FactorModel,
GARCHModel,
LinearFactorModel,
LogReturn,
MarketAdjustedModel,
MarketModel,
ReturnCalculation,
RollingWindowModel,
SimpleReturn,
VolatilityModel,
VolumeModel
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.