[Eventstudies-commits] r371 - in pkg: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Oct 8 00:45:59 CEST 2014


Author: chiraganand
Date: 2014-10-08 00:45:58 +0200 (Wed, 08 Oct 2014)
New Revision: 371

Modified:
   pkg/R/eventstudy.R
   pkg/man/eventstudy.Rd
Log:
Return NULL if output from any model is NULL.

Modified: pkg/R/eventstudy.R
===================================================================
--- pkg/R/eventstudy.R	2014-10-07 22:40:11 UTC (rev 370)
+++ pkg/R/eventstudy.R	2014-10-07 22:45:58 UTC (rev 371)
@@ -18,7 +18,7 @@
   }
 
   if (type != "None" && is.null(model.args)) {
-      stop("model.args cannot be NULL when type is not None.")
+      stop("model.args cannot be NULL when 'type' is not 'None'.")
   }
 
   if (is.levels == TRUE) {
@@ -81,11 +81,19 @@
   ## marketResidual
   if (type == "marketResidual") {
     outputModel <- marketResidual(firm.returns, model.args$market.returns)
+    if (is.null(outputModel)) {
+      cat("Error: marketResidual() returned NULL\n")
+      return(NULL)
+    }
   }
 
   ## excessReturn
   if (type == "excessReturn") {
     outputModel <- excessReturn(firm.returns, model.args$market.returns)
+    if (is.null(outputModel)) {
+      cat("Error: excessReturn() returned NULL\n")
+      return(NULL)
+    }
   }
   
 ### Converting index outputModel to Date

Modified: pkg/man/eventstudy.Rd
===================================================================
--- pkg/man/eventstudy.Rd	2014-10-07 22:40:11 UTC (rev 370)
+++ pkg/man/eventstudy.Rd	2014-10-07 22:45:58 UTC (rev 371)
@@ -158,7 +158,8 @@
 
 \value{
   A list with class attribute \dQuote{es} holding the following
-  elements:
+  elements, or \sQuote{NULL} if output from a model function is
+  \sQuote{NULL}:
 
   \itemize{
     \item{\dQuote{eventstudy.output}:}{



More information about the Eventstudies-commits mailing list