[Eventstudies-commits] r349 - in pkg: R data inst/tests man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu May 15 20:44:20 CEST 2014
Author: chiraganand
Date: 2014-05-15 20:44:20 +0200 (Thu, 15 May 2014)
New Revision: 349
Modified:
pkg/R/eesInference.R
pkg/R/phys2eventtime.R
pkg/data/SplitDates.rda
pkg/inst/tests/test_SplitDates.rda
pkg/inst/tests/test_eventstudy.R
pkg/inst/tests/test_inr_inference.R
pkg/inst/tests/test_interfaces.R
pkg/man/eventstudy.Rd
pkg/man/phys2eventtime.Rd
Log:
Changed colnames of event list.
Modified: pkg/R/eesInference.R
===================================================================
--- pkg/R/eesInference.R 2014-05-15 18:27:01 UTC (rev 348)
+++ pkg/R/eesInference.R 2014-05-15 18:44:20 UTC (rev 349)
@@ -693,18 +693,18 @@
days.bad.purged <- index(data.no.cluster[which(data.no.cluster[,"left.tail"]==1)])
days.good.purged <- index(data.no.cluster[which(data.no.cluster[,"right.tail"]==1)])
## Event list
- events.good.normal <- data.frame(outcome.unit=rep("response.series",
+ events.good.normal <- data.frame(when=rep("response.series",
length(days.good.normal)),
- event.when=days.good.normal)
- events.bad.normal <- data.frame(outcome.unit=rep("response.series",
+ when=days.good.normal)
+ events.bad.normal <- data.frame(name=rep("response.series",
length(days.bad.normal)),
- event.when=days.bad.normal)
- events.good.purged <- data.frame(outcome.unit=rep("response.series",
+ when=days.bad.normal)
+ events.good.purged <- data.frame(name=rep("response.series",
length(days.good.purged)),
- event.when=days.good.purged)
- events.bad.purged <- data.frame(outcome.unit=rep("response.series",
+ when=days.good.purged)
+ events.bad.purged <- data.frame(name=rep("response.series",
length(days.bad.purged)),
- event.when=days.bad.purged)
+ when=days.bad.purged)
dates <- list(events.good.normal=events.good.normal,
events.bad.normal=events.bad.normal,
events.good.purged=events.good.purged,
Modified: pkg/R/phys2eventtime.R
===================================================================
--- pkg/R/phys2eventtime.R 2014-05-15 18:27:01 UTC (rev 348)
+++ pkg/R/phys2eventtime.R 2014-05-15 18:44:20 UTC (rev 349)
@@ -2,8 +2,8 @@
# z is a zoo object containing input data. E.g. this could be all the
# prices of a bunch of stocks. The column name is the unit name.
# events is a data.frame containing 2 columns. The first column
-# ("outcome.unit") is the name of the unit. The second column is the date/time
-# ("event.when") when the event happened.
+# ("name") is the name of the unit. The second column is the date/time
+# ("when") when the event happened.
# For each event, the outcome can be:
# unitmissing : a unit named in events isn't in z
# wrongspan : the event date isn't placed within the span of data for the unit
@@ -13,9 +13,9 @@
phys2eventtime <- function(z, events, width=10) {
## Ensuring class of event matrix
- events$outcome.unit <- as.character(events$outcome.unit)
- if(is.factor(events$event.when)) {
- stop("The column 'event.when' cannot be a factor. Cannot proceed with data manipulation.")
+ events$name <- as.character(events$name)
+ if(is.factor(events$when)) {
+ stop("The column 'when' cannot be a factor. Cannot proceed with data manipulation.")
}
## z: physical time matrix. Check dimensions of "z"
Modified: pkg/data/SplitDates.rda
===================================================================
(Binary files differ)
Modified: pkg/inst/tests/test_SplitDates.rda
===================================================================
(Binary files differ)
Modified: pkg/inst/tests/test_eventstudy.R
===================================================================
--- pkg/inst/tests/test_eventstudy.R 2014-05-15 18:27:01 UTC (rev 348)
+++ pkg/inst/tests/test_eventstudy.R 2014-05-15 18:44:20 UTC (rev 349)
@@ -14,12 +14,12 @@
12426, 12429, 12430, 12431, 12432), class = "Date"),
class = "zoo")
# An example events list
-eventslist <- data.frame(outcome.unit=c("ITC","Reliance","Infosys",
+eventslist <- data.frame(name=c("ITC","Reliance","Infosys",
"ITC","Reliance","Junk"),
- event.when=as.Date(c(
+ when=as.Date(c(
"2004-01-02", "2004-01-08", "2004-01-14",
"2005-01-15", "2004-01-01", "2005-01-01")))
-eventslist$outcome.unit <- as.character(eventslist$outcome.unit)
+eventslist$name <- as.character(eventslist$name)
# What we expect if we don't worry about width --
rawres <- structure(list(z.e = structure(c(NA, NA, NA, NA, NA, NA,
@@ -62,7 +62,7 @@
cat("\nTesting handling of missing data on event date: ")
eventdate <- "2004-01-10"
eventdate_output <- "2004-01-09"
-eventslist <- data.frame(outcome.unit = "ITC", event.when = eventdate,
+eventslist <- data.frame(name = "ITC", when = eventdate,
stringsAsFactors = FALSE)
a <- phys2eventtime(p, eventslist, width = 2)
expect_that(as.numeric(a$z.e["0",]),
Modified: pkg/inst/tests/test_inr_inference.R
===================================================================
--- pkg/inst/tests/test_inr_inference.R 2014-05-15 18:27:01 UTC (rev 348)
+++ pkg/inst/tests/test_inr_inference.R 2014-05-15 18:44:20 UTC (rev 349)
@@ -7,8 +7,8 @@
inr_returns <- diff(log(INR))[-1]
-eventslist <- data.frame(outcome.unit=rep("inr",10),
- event.when=as.Date(c(
+eventslist <- data.frame(name=rep("inr",10),
+ when=as.Date(c(
"2010-04-20","2010-07-02","2010-07-27",
"2010-09-16","2010-11-02","2011-01-25",
"2011-03-17","2011-05-03","2011-06-16",
Modified: pkg/inst/tests/test_interfaces.R
===================================================================
--- pkg/inst/tests/test_interfaces.R 2014-05-15 18:27:01 UTC (rev 348)
+++ pkg/inst/tests/test_interfaces.R 2014-05-15 18:44:20 UTC (rev 349)
@@ -13,8 +13,8 @@
2.37333344340029)
expected_outcomes <- c("success", "success")
- test_events <- data.frame(outcome.unit = "ONGC",
- event.when = c("2011-08-01", "2010-05-14"),
+ test_events <- data.frame(name = "ONGC",
+ when = c("2011-08-01", "2010-05-14"),
stringsAsFactors = FALSE)
test_returns<- StockPriceReturns[complete.cases(StockPriceReturns$ONGC), "ONGC",
drop = FALSE]
@@ -34,8 +34,8 @@
0.904144365357373, -0.806779427723603)
expected_outcomes <- c("success", "success")
- test_events <- data.frame(outcome.unit = "ONGC",
- event.when = c("2011-08-01", "2010-05-14"),
+ test_events <- data.frame(name = "ONGC",
+ when = c("2011-08-01", "2010-05-14"),
stringsAsFactors = FALSE)
test_returns<- StockPriceReturns[complete.cases(StockPriceReturns$ONGC), "ONGC",
drop = FALSE]
@@ -78,7 +78,7 @@
1.15001275036422, 2.88646832315114, 3.32315429568726)
expected_outcomes <- c("success", "success")
- test_events <- data.frame(outcome.unit = "ONGC",
+ test_events <- data.frame(name = "ONGC",
event.when = c("2011-08-01", "2010-05-14"),
stringsAsFactors = FALSE)
test_returns<- StockPriceReturns[complete.cases(StockPriceReturns$ONGC), "ONGC",
@@ -96,7 +96,7 @@
### Remapping
cat("\nChecking remapping: ")
- test_events <- data.frame(outcome.unit = "ONGC",
+ test_events <- data.frame(name = "ONGC",
event.when = c("2011-08-01", "2010-05-14"),
stringsAsFactors = FALSE)
test_returns <- StockPriceReturns[complete.cases(StockPriceReturns$ONGC), "ONGC",
@@ -178,8 +178,8 @@
load("test_StockPriceReturns.rda")
cat("\nChecking single series handling: ")
- test_events <- data.frame(outcome.unit = "ONGC",
- event.when = c("2011-08-01", "2010-05-14"),
+ test_events <- data.frame(name = "ONGC",
+ when = c("2011-08-01", "2010-05-14"),
stringsAsFactors = FALSE)
test_returns<- StockPriceReturns$ONGC
expect_error(eventstudy(firm.returns = test_returns,
Modified: pkg/man/eventstudy.Rd
===================================================================
--- pkg/man/eventstudy.Rd 2014-05-15 18:27:01 UTC (rev 348)
+++ pkg/man/eventstudy.Rd 2014-05-15 18:44:20 UTC (rev 349)
@@ -31,8 +31,8 @@
\item{eventList}{
a \code{data.frame} of two columns with event dates (colname:
- \dQuote{event.when}) and column names of the \sQuote{response}
- series from \sQuote{firm.returns} (colname \dQuote{outcome.unit}).
+ \dQuote{when}) and column names of the \sQuote{response}
+ series from \sQuote{firm.returns} (colname \dQuote{name}).
}
\item{width}{an \sQuote{integer} of length 1 that specifies a
@@ -245,8 +245,8 @@
plot(es)
# Event study using Augmented Market Model
-events <- data.frame(outcome.unit = c("Infosys", "TCS"),
- event.when = c("2012-04-01", "2012-06-01"),
+events <- data.frame(name = c("Infosys", "TCS"),
+ when = c("2012-04-01", "2012-06-01"),
stringsAsFactors = FALSE)
es <- eventstudy(firm.returns = StockPriceReturns,
Modified: pkg/man/phys2eventtime.Rd
===================================================================
--- pkg/man/phys2eventtime.Rd 2014-05-15 18:27:01 UTC (rev 348)
+++ pkg/man/phys2eventtime.Rd 2014-05-15 18:44:20 UTC (rev 349)
@@ -29,8 +29,8 @@
\details{
- \dQuote{events} object contains two columns: \dQuote{outcome.unit}
- consists of names of the event, and \dQuote{event.when} is the
+ \dQuote{events} object contains two columns: \dQuote{name}
+ consists of names of the event, and \dQuote{when} is the
respective event identifier. For instance, if \sQuote{z} is a matrix
of class \pkg{xts} with 10 stocks over 300 days, the names of stocks
in \sQuote{z} is the superset of names for the event and the time
More information about the Eventstudies-commits
mailing list