[Eventstudies-commits] r367 - in pkg: R inst/tests vignettes

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri May 23 19:43:44 CEST 2014


Author: chiraganand
Date: 2014-05-23 19:43:44 +0200 (Fri, 23 May 2014)
New Revision: 367

Modified:
   pkg/R/eventstudy.R
   pkg/inst/tests/test_interfaces.R
   pkg/vignettes/eventstudies.Rnw
Log:
Changed eventstudy.output with result.

Modified: pkg/R/eventstudy.R
===================================================================
--- pkg/R/eventstudy.R	2014-05-23 17:36:26 UTC (rev 366)
+++ pkg/R/eventstudy.R	2014-05-23 17:43:44 UTC (rev 367)
@@ -153,7 +153,7 @@
   }
   if(to.remap==TRUE){remapping <- remap} else {remapping <- "none"}
 
-  final.result <- list(eventstudy.output = result,
+  final.result <- list(result = result,
                        outcomes = as.character(es$outcomes))
 
   attr(final.result, which = "inference") <- inference.strategy
@@ -169,9 +169,9 @@
 #########################
 
 print.es <- function(x, ...){
-  cat("Event study", colnames(x$eventstudy.output)[2], "response with",
+  cat("Event study", colnames(x$result)[2], "response with",
       attr(x, "inference"), "inference for CI:\n")
-  print(x$eventstudy.output)
+  print(x$result)
   cat("\n","Event outcome has",length(which(x$outcomes=="success")),
       "successful outcomes out of", length(x$outcomes),"events:","\n")
   print(x$outcomes)
@@ -182,13 +182,13 @@
 }
 
 plot.es <- function(x, xlab = NULL, ylab = NULL, ...){
-  if (NCOL(x$eventstudy.output) < 3) {
+  if (NCOL(x$result) < 3) {
       cat("Error: No confidence bands available to plot.\n")
       return(invisible(NULL))
   }
-  big <- max(abs(x$eventstudy.output))
+  big <- max(abs(x$result))
   hilo <- c(-big,big)
-  width <- (nrow(x$eventstudy.output)-1)/2
+  width <- (nrow(x$result)-1)/2
 
   ## assign own labels if they're missing
   if (is.null(ylab)) {
@@ -208,13 +208,13 @@
       xlab <- "Event time"
   }
 
-  plot(-width:width, x$eventstudy.output[,2], type="l", lwd=2, ylim=hilo,
+  plot(-width:width, x$result[,2], type="l", lwd=2, ylim=hilo,
        xlab = xlab, ylab = ylab, ...)
 
-  points(-width:width, x$eventstudy.output[,2])
-  lines(-width:width, x$eventstudy.output[,"2.5%"],
+  points(-width:width, x$result[,2])
+  lines(-width:width, x$result[,"2.5%"],
         lwd=1, lty=2, ...)
-  lines(-width:width, x$eventstudy.output[,"97.5%"],
+  lines(-width:width, x$result[,"97.5%"],
         lwd=1, lty=2, ...)
   abline(h=0,v=0)
 }

Modified: pkg/inst/tests/test_interfaces.R
===================================================================
--- pkg/inst/tests/test_interfaces.R	2014-05-23 17:36:26 UTC (rev 366)
+++ pkg/inst/tests/test_interfaces.R	2014-05-23 17:43:44 UTC (rev 367)
@@ -23,7 +23,7 @@
                      event.window = 3,
                      model.args = list(market.returns = NiftyIndex))
 
-    expect_that(expected_mean, equals(test_es$eventstudy.output[, "Mean"]))
+    expect_that(expected_mean, equals(test_es$result[, "Mean"]))
     expect_that(expected_outcomes, equals(test_es$outcomes))
     expect_is(test_es, "es")
 
@@ -44,7 +44,7 @@
                           event.window = 3,
                           type = "None")
 
-    expect_that(expected_mean, equals(test_es$eventstudy.output[, "Mean"]))
+    expect_that(expected_mean, equals(test_es$result[, "Mean"]))
     expect_that(expected_outcomes, equals(test_es$outcomes))
     expect_is(test_es, "es")
 
@@ -68,7 +68,7 @@
                           model.args = list(market.returns = NiftyIndex[index(USDINR)],
                           others = test_others))
 
-    expect_that(expected_mean, equals(test_es$eventstudy.output[, "Mean"]))
+    expect_that(expected_mean, equals(test_es$result[, "Mean"]))
     expect_that(expected_outcomes, equals(test_es$outcomes))
     expect_is(test_es, "es")
 
@@ -90,7 +90,7 @@
                           type = "excessReturn",
                           model.args = list(market.returns = NiftyIndex))
 
-    expect_that(expected_mean, equals(test_es$eventstudy.output[, "Mean"]))
+    expect_that(expected_mean, equals(test_es$result[, "Mean"]))
     expect_that(expected_outcomes, equals(test_es$outcomes))
     expect_is(test_es, "es")
 

Modified: pkg/vignettes/eventstudies.Rnw
===================================================================
--- pkg/vignettes/eventstudies.Rnw	2014-05-23 17:36:26 UTC (rev 366)
+++ pkg/vignettes/eventstudies.Rnw	2014-05-23 17:43:44 UTC (rev 367)
@@ -117,7 +117,7 @@
 \texttt{eventstudy()} was run: the inference procedure adopted (``\texttt{bootstrap}''
 inference in this case), the window width (10 in this case) and the
 method used for mapping the data (``\texttt{cumsum}''). The two new things are
-`\texttt{outcomes}' and `\texttt{eventstudy.output}'.
+`\texttt{outcomes}' and `\texttt{result}'.
 
 The vector `\texttt{outcomes}' shows the disposition of each event in the
 events table. There are 22 rows in \emph{SplitDates}, hence there will be 22
@@ -256,9 +256,9 @@
 interval at date 0 as a measure of efficiency.
 
 <<efficiency-comparison,results=verbatim>>=
-tmp <- rbind(es$eventstudy.output[10, ],
-             es.mm$eventstudy.output[10, ],
-             es.amm$eventstudy.output[10, ]
+tmp <- rbind(es$result[10, ],
+             es.mm$result[10, ],
+             es.amm$result[10, ]
              )[,c(1,3)]
 rownames(tmp) <- c("None", "MM", "AMM")
 



More information about the Eventstudies-commits mailing list