Autodocs

EventStudies.BootstrapInferenceType
BootstrapInference(sampling_method::Bootstrap.BootstrapSampling)
BootstrapInference(; replicates = 1000)

Creates an instance of BootstrapSampling for use in inference. This can be constructed using a Bootstrap.BootstrapSampling subtype directly, or by the convenience keyword constructor which creates a BootstrapInference backed by BasicSampling.

Available sampling methods

  • Random resampling with replacement (BasicSampling)
  • Antithetic resampling, introducing negative correlation between samples (AntitheticSampling)
  • Balanced random resampling, reducing bias (BalancedSampling)
  • Exact resampling, iterating through all unique resamples ([]ExactSampling](@ref)): deterministic bootstrap, suited for small samples sizes
  • Resampling of residuals in generalized linear models (ResidualSampling, WildSampling)
  • Maximum Entropy bootstrapping for dependent and non-stationary datasets (MaximumEntropySampling)
source
EventStudies.EventStatusType
abstract type EventStatus

An abstract supertype for all event status types. These are used to indicate the status of an event (i.e., if it was successful or not, and if so why it was unsuccessful).

source
EventStudies.InvalidColnameType

This means that the column name was not found in the data. It prints the column name. Equivalent to unitmissing in eventstudies.R.

source
EventStudies.WilcoxonInferenceType
WilcoxonInference(; exact = nothing)

Creates an instance of WilcoxonInference for use in inference. This forwards to the Wilcoxon inference test from HypothesisTests.jl.

If exact = nothing, then a heuristic determines whether to use the exact or approximate Wilcoxon signed-rank test. If exact = true, then the exact test is used; if exact = false, then the approximate test is used. If exact = nothing, then a heuristic determines whether to use the exact or approximate tests.

source
EventStudies.eventstudyMethod
eventstudy(
    return_timeseries::TSFrame, 
    event_times::Vector{Pair{Symbol, T}}, 
    window::Int, 
    model = nothing; 
    verbose = true
    ) where T

Takes in a TSFrame of returns, a vector of pairs of column names and event times, and a window size. It then returns a TSFrame of event windows, where each column is the event return for the corresponding event.

Arguments

  • return_timeseries is a TSFrame which contains the returns of the assets.
  • event_times is a vector of pairs, where the first element is the name of the column in return_timeseries and the second element is the time of the event. This is in the form :colname => date.
  • window is the number of data points before and after the event to include in the event window. It may be an Integer, which describes a range -window:1:window. It may also be an AbstractVector of Integers or Dates.Periods, which describes the exact window to use.
  • model is the decorrelating function to apply.
  • verbose is a boolean which indicates whether to print information about the event study.
source
EventStudies.inferenceFunction
inference(inf::BootstrapInference, ts::TSFrame, conf = 0.975)

Performs bootstrap inference and returns a tuple of vectors (t₀, lower, upper).

source
EventStudies.inferenceFunction
inference(::ClassicInference, ts::TSFrame, conf = 0.975)

Performs classic T-test inference and returns a tuple of vectors (t₀, lower, upper).

source
EventStudies.inferenceMethod
inference(::WilcoxonInference{ExactType}, ts::TSFrame, conf = 0.975) where ExactType

Performs Wilcoxon signed-rank inference and returns a tuple of vectors (t₀, lower, upper).

source
EventStudies.levels_to_returnsFunction
levels_to_returns(ts::TSFrame [, base = 100])::TSFrame

Converts the data in ts into "returns" data, i.e., executes diff(log(ts)) .* base on each column of ts.

source
EventStudies.load_dataMethod
load_data(dataset::String)

Load a dataset from the EventStudies.jl package. The dataset can be either a CSV file or an RData file, which is shipped along with EventStudies.jl!

source
EventStudies.physical_to_event_timeMethod
physical_to_event_time(timeseries::TSFrame, event_times::Vector{Pair{Symbol, T}}, window::Union{Integer, AbstractVector{<: Integer}}, model = nothing) where T

Converts the input TSFrame to a vector of TSFrames - one per successful event, centered around the event time.

Arguments are the same as eventstudy. Note that model is not applied here, but its contents are checked to ensure that the model has data in that span.

Returns a tuple (event_tsframes, event_time_indices, event_return_codes):

  • event_tsframes::Vector{TSFrame}: a vector of TSFrames, one per successful event.
  • event_time_indices::Vector{Int}: the (integer) indices in timeseries of the events.
  • event_return_codes::Vector{EventStatus}: the status of each event. This is a vector of EventStudies.EventStatus objects, of the same length as the input event_times.
source
EventStudies.remap_cumsumMethod
remap_cumsum(ts::TSFrame; base = 0)

This function remaps a time series into its cumulative summation. The first value of each column is set to base.

source
EventStudies.ModelsModule
Models

This module implements several decorrelating models for event studies.

API

The basic API which any struct MyModel <: Models.AbstractModel needs to implement is:

  • StatsBase.fit!(model::MyModel, data::TSFrame)
  • StatsBase.predict(model::MyModel, data::TSFrame)

Optionally,

  • Models.check_window(model::MyModel, window::AbstractVector{Int}, event_time)::Bool

There is a convenience which allows any model to be fit using StatsBase.fit(model, data). In general, the model can be constructed ahead of time by providing the index or market data which it needs to predict. Then, the model can be fit to the data using StatsBase.fit!(model, data). Finally, the model can be applied to the data using StatsBase.predict(model, data).

Models

source
EventStudies.Models.AbstractModelType
abstract type Models.AbstractModel

Abstract type for models used in EventStudies.jl. Any model should implement: StatsBase.fit!(model, data::TSFrame) and Models.apply(model, data::TSFrame).

source
EventStudies.Models.MarketModelType
struct MarketModel <: AbstractModel
MarketModel(market_returns::TSFrame)

A model which fits the firm's returns to the market returns, using some provided index or market indicator.

Fit using fit or fit!, and apply to data using apply

Fields

  • market_returns: A TSFrame which holds the market indicator/index data.

  • coefs: The coefficients of the fit. Set by fit!.

source