[Eventstudies-commits] r298 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Apr 30 07:32:12 CEST 2014


Author: chiraganand
Date: 2014-04-30 07:32:12 +0200 (Wed, 30 Apr 2014)
New Revision: 298

Modified:
   pkg/R/eventstudy.R
Log:
Fixed calling of makeX from eventstudy function, fixed default print method.

Modified: pkg/R/eventstudy.R
===================================================================
--- pkg/R/eventstudy.R	2014-04-30 04:40:10 UTC (rev 297)
+++ pkg/R/eventstudy.R	2014-04-30 05:32:12 UTC (rev 298)
@@ -37,11 +37,7 @@
       tmp.res <- zoo(x = tmp, order.by = as.Date(names(tmp)))
     }
     ## Estimating AMM regressors
-    regressors <- makeX(market.returns = extra.var$market.returns,
-                        others = extra.var$others,
-                        switch.to.innov = extra.var$switch.to.innov,
-                        market.returns.purge = extra.var$market.returns.purge,
-                        nlags = extra.var$nlags)
+    regressors <- makeX(...)
     if(NCOL(firm.returns)==1){
       ## One firm
       outputModel <- timeseriesAMM(firm.returns = firm.returns,
@@ -83,6 +79,7 @@
       attr(outputModel, "dimnames") <- list(NULL, firmNames)
       colnames(outputModel) <- firmNames
   }
+
   es <- phys2eventtime(z = outputModel, events=eventList, width=0)
 
   if (is.null(es$z.e) || length(es$z.e) == 0) {
@@ -151,7 +148,7 @@
   print(x$eventstudy.output)
   cat("\n","Event outcome has",length(which(x$outcomes=="success")),
       "successful outcomes out of", length(x$outcomes),"events:","\n")
-  x$outcomes
+  print(x$outcomes)
 }
 
 summary.es <- function(object, ...){
@@ -159,6 +156,10 @@
 }
 
 plot.es <- function(x, xlab = NULL, ylab = NULL, ...){
+  if (NCOL(x$eventstudy.output) < 3) {
+      cat("Error: No confidence bands available to plot.\n")
+      return(invisible(NULL))
+  }
   big <- max(abs(x$eventstudy.output))
   hilo <- c(-big,big)
   width <- (nrow(x$eventstudy.output)-1)/2



More information about the Eventstudies-commits mailing list