<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On 28 March 2014 15:07, <span dir="ltr"><<a href="mailto:noreply@r-forge.r-project.org" target="_blank">noreply@r-forge.r-project.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div id=":1q0" class="" style="overflow:hidden"> ### Converting index outputModel to Date<br>
index(outputModel) <- as.Date(index(outputModel))<br>
- ## Stop if there is only one firm: phys2eventtime breaks down<br>
- if(NCOL(outputModel)==1){stop("Event study does not work for one firm/column")}<br></div></blockquote><div><br></div><div>Perfect.</div><div><br></div><div> ### Convert to event frame</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div id=":1q0" class="" style="overflow:hidden">
es <- phys2eventtime(z=outputModel, events=eventList, width=width)<br>
- es.w <- window(es$z.e, start = -width, end = width)<br>
- ## Adding column names to event output<br>
- cn.names <- eventList[which(es$outcomes=="success"),1]<br>
+<br>
+ if (is.null(es$z.e) || length(es$z.e) == 0) {<br>
+ es.w <- NULL<br>
+ cn.names <- character(length = 0)<br>
+ } else {<br>
+ es.w <- window(es$z.e, start = -width, end = width)<br>
+ # Adding column names to event output<br>
+ cn.names <- eventList[which(es$outcomes=="success"),1]<br>
+ }<br>
+<br>
if(length(cn.names)==1){<br>
cat("Event date exists only for",cn.names,"\n")<br>
inference <- FALSE<br>
cat("No inference strategy for one column","\n")<br>
+ } else if (length(cn.names) == 0) {<br>
+ ## skip everything<br>
+ to.remap = FALSE<br>
+ inference = FALSE<br>
} else {<br>
colnames(es.w) <- cn.names<br>
- }<br>
+ }<br>
<br></div></blockquote><div><br></div><div>Okay. I totally agree. This makes sense to me. Except this:</div><div><br></div><div> es.w <- window(es$z.e, start = -width, end = width)<br></div><div><br></div><div>That is not what should be done right? Because this will give you result from phys2eventtime as only for the width chosen! The width differentiates "wdatamissing" from "success". No? </div>
<div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div id=":1q0" class="" style="overflow:hidden">
### Remapping event frame<br>
if (to.remap == TRUE) {<br>
@@ -124,7 +133,7 @@<br>
<a href="http://print.es" target="_blank">print.es</a> <- function(x, ...){<br>
cat("The", x$inference, "inference output for CI and",<br>
colnames(x$eventstudy.output)[2], "response:", "\n")<br>
- return(x$eventstudy.output)<br>
+ print.default(x$eventstudy.output)<br>
}<br>
<br></div></blockquote><div><br></div><div>? I don't get this. But I leave it to you. </div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div id=":1q0" class="" style="overflow:hidden">
<a href="http://summary.es" target="_blank">summary.es</a> <- function(object, ...){<br>
<br>
Modified: pkg/R/phys2eventtime.R<br>
===================================================================<br>
--- pkg/R/phys2eventtime.R 2014-03-28 13:03:55 UTC (rev 251)<br>
+++ pkg/R/phys2eventtime.R 2014-03-28 15:07:27 UTC (rev 252)<br>
@@ -47,6 +47,11 @@<br>
rownums <- grep("outcome", names(answer))<br>
outcomes <- as.character(do.call("c", answer[rownums]))<br>
z.e <- do.call("cbind", answer[rownums[which(answer[rownums] == "success")] - 1])<br>
+<br>
+ if (length(z.e) == 0) { # no point of going forward<br>
+ return(list(z.e = z.e, outcomes = factor(outcomes)))<br>
+ }<br>
+<br>
colnames(z.e) <- which(outcomes == "success")<br></div></blockquote></div><br>Okay. This is fine too. <br><br></div></div>