[Eventstudies-commits] r303 - pkg/inst/tests
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu May 1 21:29:11 CEST 2014
Author: chiraganand
Date: 2014-05-01 21:29:11 +0200 (Thu, 01 May 2014)
New Revision: 303
Added:
pkg/inst/tests/test_NiftyIndex.rda
pkg/inst/tests/test_SplitDates.rda
pkg/inst/tests/test_StockPriceReturns.rda
pkg/inst/tests/test_USDINR.rda
Modified:
pkg/inst/tests/test_interfaces.R
Log:
Added interface testing for inference procedures and remapping, added more testing data sets.
Added: pkg/inst/tests/test_NiftyIndex.rda
===================================================================
(Binary files differ)
Property changes on: pkg/inst/tests/test_NiftyIndex.rda
___________________________________________________________________
Added: svn:mime-type
+ application/x-gzip
Added: pkg/inst/tests/test_SplitDates.rda
===================================================================
(Binary files differ)
Property changes on: pkg/inst/tests/test_SplitDates.rda
___________________________________________________________________
Added: svn:mime-type
+ application/x-gzip
Added: pkg/inst/tests/test_StockPriceReturns.rda
===================================================================
(Binary files differ)
Property changes on: pkg/inst/tests/test_StockPriceReturns.rda
___________________________________________________________________
Added: svn:mime-type
+ application/x-xz
Added: pkg/inst/tests/test_USDINR.rda
===================================================================
(Binary files differ)
Property changes on: pkg/inst/tests/test_USDINR.rda
___________________________________________________________________
Added: svn:mime-type
+ application/x-gzip
Modified: pkg/inst/tests/test_interfaces.R
===================================================================
--- pkg/inst/tests/test_interfaces.R 2014-05-01 05:10:52 UTC (rev 302)
+++ pkg/inst/tests/test_interfaces.R 2014-05-01 19:29:11 UTC (rev 303)
@@ -4,8 +4,8 @@
load("test_SplitDates.rda")
load("test_StockPriceReturns.rda")
load("test_NiftyIndex.rda")
+ load("test_usdinr.rda")
-
### Basic event study with default args (market residuals)
cat("Checking market residuals interface: ")
expected_mean <- c(0, 0.0393985717416213, -0.7458035091065,
@@ -29,9 +29,9 @@
### AMM interface
cat("Checking AMM interface: ")
-XX expected_mean <- c(0, 0.0393985717416213, -0.7458035091065,
- 0.457817077869512, 0.715714066835461, 2.33986420702835,
- 2.37333344340029)
+ expected_mean <- c(0, 0.135927645042554, -0.600457594252805, 0.631525565290171,
+ 0.871423869901684, 2.54741102266723, 2.5989730099384)
+
expected_outcomes <- c("success", "success")
test_events <- data.frame(outcome.unit = "ONGC",
@@ -39,13 +39,114 @@
stringsAsFactors = FALSE)
test_returns<- StockPriceReturns[complete.cases(StockPriceReturns$ONGC), "ONGC",
drop = FALSE]
+ test_others <- USDINR
test_es <- eventstudy(firm.returns = test_returns,
eventList = test_events,
width = 3,
type = "lmAMM",
- market.returns = NiftyIndex,
+ market.returns = NiftyIndex[index(USDINR)],
others = test_others)
expect_that(expected_mean, equals(test_es$eventstudy.output[, "Mean"]))
expect_that(expected_outcomes, equals(test_es$outcomes))
expect_is(test_es, "es")
+
+### Excess return
+ cat("Checking excess return interface: ")
+ expected_mean <- c(0, 0.138567158395153, -0.631185954448288, 0.701644918222266,
+ 1.15001275036422, 2.88646832315114, 3.32315429568726)
+ expected_outcomes <- c("success", "success")
+
+ test_events <- data.frame(outcome.unit = "ONGC",
+ event.when = c("2011-08-01", "2010-05-14"),
+ stringsAsFactors = FALSE)
+ test_returns<- StockPriceReturns[complete.cases(StockPriceReturns$ONGC), "ONGC",
+ drop = FALSE]
+
+ test_es <- eventstudy(firm.returns = test_returns,
+ eventList = test_events,
+ width = 3,
+ type = "excessReturn",
+ market.returns = NiftyIndex)
+
+ expect_that(expected_mean, equals(test_es$eventstudy.output[, "Mean"]))
+ expect_that(expected_outcomes, equals(test_es$outcomes))
+ expect_is(test_es, "es")
+
+### Remapping
+ cat("Checking remapping: ")
+ test_events <- data.frame(outcome.unit = "ONGC",
+ event.when = c("2011-08-01", "2010-05-14"),
+ stringsAsFactors = FALSE)
+ test_returns <- StockPriceReturns[complete.cases(StockPriceReturns$ONGC), "ONGC",
+ drop = FALSE]
+
+ ## cumsum
+ test_es <- eventstudy(firm.returns = test_returns,
+ eventList = test_events,
+ width = 3,
+ type = "None",
+ to.remap = FALSE,
+ remap = "cumsum")
+
+ test_es_remap <- eventstudy(firm.returns = test_returns,
+ eventList = test_events,
+ width = 3,
+ type = "None",
+ to.remap = TRUE,
+ remap = "cumsum")
+
+ expect_error(expect_that(test_es, equals(test_es_remap)))
+
+ ## cumprod
+ test_es <- eventstudy(firm.returns = test_returns,
+ eventList = test_events,
+ width = 3,
+ type = "None",
+ to.remap = FALSE,
+ remap = "cumprod")
+
+ test_es_remap <- eventstudy(firm.returns = test_returns,
+ eventList = test_events,
+ width = 3,
+ type = "None",
+ to.remap = TRUE,
+ remap = "cumprod")
+
+ expect_error(expect_that(test_es, equals(test_es_remap)))
+
+### Inference
+ cat("Checking inference interface: ")
+ ## bootstrap
+ test_es_inference <- eventstudy(firm.returns = test_returns,
+ eventList = test_events,
+ width = 3,
+ type = "None",
+ inference = TRUE,
+ inference.strategy = "bootstrap")
+
+ test_es <- eventstudy(firm.returns = test_returns,
+ eventList = test_events,
+ width = 3,
+ type = "None",
+ inference = FALSE,
+ inference.strategy = "bootstrap")
+
+ expect_error(expect_that(test_es_inference, equals(test_es)))
+
+ ## wilcoxon
+ test_es_inference <- eventstudy(firm.returns = test_returns,
+ eventList = test_events,
+ width = 3,
+ type = "None",
+ inference = TRUE,
+ inference.strategy = "wilcoxon")
+
+ test_es <- eventstudy(firm.returns = test_returns,
+ eventList = test_events,
+ width = 3,
+ type = "None",
+ inference = FALSE,
+ inference.strategy = "wilcoxon")
+
+ expect_error(expect_that(test_es_inference, equals(test_es)))
More information about the Eventstudies-commits
mailing list