[Eventstudies-commits] r96 - pkg/inst/tests
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Jul 22 11:29:59 CEST 2013
Author: vikram
Date: 2013-07-22 11:29:59 +0200 (Mon, 22 Jul 2013)
New Revision: 96
Added:
pkg/inst/tests/test_marketresiduals.R
Modified:
pkg/inst/tests/test_inr_inference.R
Log:
Added market residual test case
Modified: pkg/inst/tests/test_inr_inference.R
===================================================================
--- pkg/inst/tests/test_inr_inference.R 2013-07-16 14:07:04 UTC (rev 95)
+++ pkg/inst/tests/test_inr_inference.R 2013-07-22 09:29:59 UTC (rev 96)
@@ -3,7 +3,7 @@
test_that("test.inr.inference", {
library(eventstudies)
-load(system.file("data", "inr.rda", package = "eventstudies"))
+load(system.file("data", "inr.rda",package = "eventstudies"))
inr_returns <- diff(log(inr))[-1]
Added: pkg/inst/tests/test_marketresiduals.R
===================================================================
--- pkg/inst/tests/test_marketresiduals.R (rev 0)
+++ pkg/inst/tests/test_marketresiduals.R 2013-07-22 09:29:59 UTC (rev 96)
@@ -0,0 +1,17 @@
+context("Market residuals")
+
+test_that("test.market.residuals", {
+library(eventstudies)
+
+load(system.file("data", "inr.rda", package = "eventstudies"))
+
+mm.formula <- paste("ranbaxyacp","~","nifty",sep="")
+mm.result <- marketResidual(mm.formula=mm.formula,data.object=mmData)
+
+# Calculating manually
+result <- lm(ranbaxyacp ~ nifty, data=mmData)
+resid.res <- xts(result$resid,as.Date(attr(result$resid,"names")))
+
+expect_that(mm.result,equals(resid.res))
+
+})
More information about the Eventstudies-commits
mailing list