[Eventstudies-commits] r109 - in pkg: R man vignettes
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Aug 4 21:45:30 CEST 2013
Author: vikram
Date: 2013-08-04 21:45:30 +0200 (Sun, 04 Aug 2013)
New Revision: 109
Modified:
pkg/R/eventstudy.R
pkg/man/onefirmAMM.Rd
pkg/vignettes/eventstudies.Rnw
Log:
Modified for minor error in one firm data; code works fine; checking failure in test case
Modified: pkg/R/eventstudy.R
===================================================================
--- pkg/R/eventstudy.R 2013-08-04 09:01:44 UTC (rev 108)
+++ pkg/R/eventstudy.R 2013-08-04 19:45:30 UTC (rev 109)
@@ -17,10 +17,6 @@
outputModel <- inputData
}
- ## else {
- ## stop("inputData or \"None\" type missing")
- ## }
-
if (is.levels == TRUE) {
inputData <- diff(log(inputData)) * 100
}
@@ -51,10 +47,12 @@
if (type == "excessReturn") {
outputModel <- excessReturn(data.object = inputData, ...)
}
- ##Converting index outputModel to Date
- index(outputModel) <- as.Date(index(outputModel))
-
+### Converting index outputModel to Date
+ index(outputModel) <- as.Date(index(outputModel))
+ ## Stop if there is only one firm: phys2eventtime breaks down
+ if(NCOL(outputModel)==1){stop("Event study does not work for one firm/column")}
+
### Convert to event frame
es <- phys2eventtime(z=outputModel, events=eventList, width=width)
es.w <- window(es$z.e, start = -width, end = width)
Modified: pkg/man/onefirmAMM.Rd
===================================================================
--- pkg/man/onefirmAMM.Rd 2013-08-04 09:01:44 UTC (rev 108)
+++ pkg/man/onefirmAMM.Rd 2013-08-04 19:45:30 UTC (rev 109)
@@ -10,7 +10,7 @@
}
\usage{
-onefirmAMM(rj, X, nlags = NA, verbose = FALSE, dates = NULL, residual = TRUE)
+onefirmAMM(rj, X, nlags = 1, verbose = FALSE, dates = NULL, residual = TRUE)
}
\arguments{
Modified: pkg/vignettes/eventstudies.Rnw
===================================================================
--- pkg/vignettes/eventstudies.Rnw 2013-08-04 09:01:44 UTC (rev 108)
+++ pkg/vignettes/eventstudies.Rnw 2013-08-04 19:45:30 UTC (rev 109)
@@ -334,21 +334,27 @@
rM1=y3c3$NIFTY_INDEX, others=y3c3$INRUSD,
switch.to.innov=TRUE, rM1purge=TRUE, nlags=1)
+of1 <- AMM(amm.type="onefirm",rj=y3c3$Company_A,
+ verbose=TRUE,
+ dates= NULL,
+ rM1=y3c3$NIFTY_INDEX, others=y3c3$INRUSD,
+ switch.to.innov=TRUE, rM1purge=TRUE, nlags=1)
+
of.r <- AMM(amm.type="manyfirms", rj=stock.data[,1:5],verbose=TRUE, dates=NULL,
rM1=all.data$nifty, others=all.data$inr, switch.to.innov=TRUE,
rM1purge=TRUE, nlags=1)
-es.ammonefirm <- eventstudy(inputData = stock.data[,1:4],
- eventList = SplitDates,
- width = 10, to.remap = TRUE, remap = "cumsum",
- to.plot = TRUE, inference = TRUE,
- inference.strategy = "bootstrap",
- type = "AMM", amm.type="manyfirms",
- rM1=all.data$nifty, others=all.data$inr,
- nlags=1, verbose=TRUE,
- dates= NULL,
- switch.to.innov=TRUE, rM1purge=TRUE, nlags=1)
+es.amm <- eventstudy(inputData = stock.data,
+ eventList = SplitDates,
+ width = 10, to.remap = TRUE, remap = "cumsum",
+ to.plot = TRUE, inference = TRUE,
+ inference.strategy = "bootstrap",
+ type = "AMM", amm.type="manyfirms",
+ rM1=all.data$nifty, others=all.data$inr,
+ nlags=1, verbose=TRUE,
+ dates= NULL,
+ switch.to.innov=TRUE, rM1purge=TRUE, nlags=1)
@
More information about the Eventstudies-commits
mailing list