wilcoxon_test: An event study Wilcoxon signed rank test.

View source: R/nonparametric_tests.R

wilcoxon_testR Documentation

An event study Wilcoxon signed rank test.

Description

Performs Wilcoxon test on the event period for abnormal returns (abnormal returns are considered as differences).

Usage

wilcoxon_test(list_of_returns, event_start, event_end)

Arguments

list_of_returns

a list of objects of S3 class returns, each element of which is treated as a security.

event_start

an object of Date class giving the first date of the event period.

event_end

an object of Date class giving the last date of the event period.

Details

The estimation periods can overlap with event windows, because the procedure takes into account only abnormal returns from the event window. The test has the same algorithm as built-in R wilcox.test. The critical values are exact values, which are obtained from qsignrank. The algorithm is the following: for each day in event window the cross-sectional abnormal returns treated as sample of differences. Firstly the absolute value of these differences are computed, and corresponding ranks of non-zero values are calculated. The test statistic is the sum of ranks, corresponding to positive abnormal returns. The significance levels of α are 0.1, 0.05, and 0.01 (marked respectively by *, **, and ***).

Value

A data frame of the following columns:

  • date: a calendar date

  • weekday: a day of the week

  • percentage: a share of non-missing observations for a given day

  • wlcx_stat: a Wilcoxon signed rank test statistic

  • wlcx_signif: a significance of the statistic

References

  • Wilcoxon F. Individual Comparisons by Ranking Methods. Biometrics Bulletin 1(6):80-83, 1945.

  • Kolari J.W., Pynnonen S. Event Study Testing with Cross-sectional Correlation of Abnormal Returns. The Review of Financial Studies, 23(11):3996-4025, 2010.

  • Lehmann E.L, Nonparametrics: Statistical Methods Based on Ranks. San Francisco: Holden-Day, 1975.

  • Hollander M., Wolfe D.A. Nonparametric Statistical Methods. New York: John Wiley & Sons, 1973.

See Also

nonparametric_tests, sign_test, generalized_sign_test, corrado_sign_test, rank_test, and modified_rank_test.

Examples

## Not run: 
library("magrittr")
rates_indx <- get_prices_from_tickers("^GSPC",
                                      start = as.Date("2019-04-01"),
                                      end = as.Date("2020-04-01"),
                                      quote = "Close",
                                      retclass = "zoo") %>%
    get_rates_from_prices(quote = "Close",
                          multi_day = TRUE,
                          compounding = "continuous")
tickers <- c("AMZN", "ZM", "UBER", "NFLX", "SHOP", "FB", "UPWK")
get_prices_from_tickers(tickers,
                        start = as.Date("2019-04-01"),
                        end = as.Date("2020-04-01"),
                        quote = "Close",
                        retclass = "zoo") %>%
    get_rates_from_prices(quote = "Close",
                          multi_day = TRUE,
                          compounding = "continuous") %>%
    apply_market_model(regressor = rates_indx,
                       same_regressor_for_all = TRUE,
                       market_model = "sim",
                       estimation_method = "ols",
                       estimation_start = as.Date("2019-04-01"),
                       estimation_end = as.Date("2020-03-13")) %>%
    wilcoxon_test(event_start = as.Date("2020-03-16"),
                  event_end = as.Date("2020-03-20"))

## End(Not run)
## The result of the code above is equivalent to:
data(securities_returns)
wilcoxon_test(list_of_returns = securities_returns,
              event_start =  as.Date("2020-03-16"),
              event_end = as.Date("2020-03-20"))


irudnyts/estudy2 documentation built on April 21, 2022, 10:50 p.m.