[Eventstudies-commits] r301 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu May 1 07:09:21 CEST 2014


Author: chiraganand
Date: 2014-05-01 07:09:21 +0200 (Thu, 01 May 2014)
New Revision: 301

Modified:
   pkg/R/eventstudy.R
Log:
Moved single firm handling out of lmAMM.

Modified: pkg/R/eventstudy.R
===================================================================
--- pkg/R/eventstudy.R	2014-04-30 18:56:29 UTC (rev 300)
+++ pkg/R/eventstudy.R	2014-05-01 05:09:21 UTC (rev 301)
@@ -19,15 +19,16 @@
   if (is.levels == TRUE) {
     firm.returns <- diff(log(firm.returns)) * 100
   }
-  
+
+  ## handle single series
+  if (is.null(ncol(firm.returns))) {
+      stop("firm.returns should be a zoo series with at least one column. Use '[' with 'drop = FALSE'.")
+  }
+  firmNames <- colnames(firm.returns)
+
 ### Run models
   ## AMM
   if (type == "lmAMM") {
-    if (is.null(ncol(firm.returns))) {
-        stop("firm.returns should be a zoo series with at least one column. Use '[' with 'drop = FALSE'.")
-    }
-    firmNames <- colnames(firm.returns)
-
     ## AMM residual to time series
     timeseriesAMM <- function(firm.returns, X, verbose = FALSE, nlags = 1) {
       tmp <- resid(lmAMM(firm.returns = firm.returns,



More information about the Eventstudies-commits mailing list