[Eventstudies-commits] r305 - pkg/inst/tests
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri May 2 10:42:30 CEST 2014
Author: chiraganand
Date: 2014-05-02 10:42:29 +0200 (Fri, 02 May 2014)
New Revision: 305
Modified:
pkg/inst/tests/test_interfaces.R
Log:
Added test for no model output and checking for no colname in firm returns.
Modified: pkg/inst/tests/test_interfaces.R
===================================================================
--- pkg/inst/tests/test_interfaces.R 2014-05-02 04:30:58 UTC (rev 304)
+++ pkg/inst/tests/test_interfaces.R 2014-05-02 08:42:29 UTC (rev 305)
@@ -27,6 +27,27 @@
expect_that(expected_outcomes, equals(test_es$outcomes))
expect_is(test_es, "es")
+### None
+ cat("Checking no model output: ")
+ expected_mean <- c(0, -0.197406699931557, -0.804299958306487,
+ 0.0135570496689663, -0.418062964428412,
+ 0.904144365357373, -0.806779427723603)
+ 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 = "None")
+
+ expect_that(expected_mean, equals(test_es$eventstudy.output[, "Mean"]))
+ expect_that(expected_outcomes, equals(test_es$outcomes))
+ expect_is(test_es, "es")
+
### AMM interface
cat("Checking AMM interface: ")
expected_mean <- c(0, 0.135927645042554, -0.600457594252805, 0.631525565290171,
@@ -152,3 +173,17 @@
expect_false(isTRUE(all.equal(test_es, test_es_inference)))
}) # end test_that()
+
+test_that("test.arguments", {
+ load("test_StockPriceReturns.rda")
+
+ cat("Checking single series handling: ")
+ test_events <- data.frame(outcome.unit = "ONGC",
+ event.when = c("2011-08-01", "2010-05-14"),
+ stringsAsFactors = FALSE)
+ test_returns<- StockPriceReturns$ONGC
+ expect_error(eventstudy(firm.returns = test_returns,
+ eventList = test_events,
+ width = 3,
+ type = "None"))
+})
More information about the Eventstudies-commits
mailing list