[Eventstudies-commits] r359 - in pkg: R man vignettes
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri May 16 12:08:31 CEST 2014
Author: vikram
Date: 2014-05-16 12:08:22 +0200 (Fri, 16 May 2014)
New Revision: 359
Modified:
pkg/R/eventstudy.R
pkg/man/eventstudy.Rd
pkg/vignettes/eventstudies.Rnw
Log:
Fixed the nlags issue
Modified: pkg/R/eventstudy.R
===================================================================
--- pkg/R/eventstudy.R 2014-05-16 06:36:20 UTC (rev 358)
+++ pkg/R/eventstudy.R 2014-05-16 10:08:22 UTC (rev 359)
@@ -26,16 +26,18 @@
stop("firm.returns should be a zoo series with at least one column. Use '[' with 'drop = FALSE'.")
}
firmNames <- colnames(firm.returns)
+ ## Extracting elipsis values
+ extra.var <- list(...)
+ cat("I am here:", extra.var$nlags, "\n")
### Run models
## AMM
if (type == "lmAMM") {
## AMM residual to time series
- timeseriesAMM <- function(firm.returns, X, verbose = FALSE, nlags = 1) {
+ timeseriesAMM <- function(firm.returns, X, verbose = FALSE) {
tmp <- resid(lmAMM(firm.returns = firm.returns,
X = X,
- nlags = nlags,
- verbose = FALSE))
+ verbose = FALSE, nlags = extra.var$nlags))
tmp.res <- zoo(x = tmp, order.by = as.Date(names(tmp)))
}
## Estimating AMM regressors
@@ -44,8 +46,8 @@
## One firm
outputModel <- timeseriesAMM(firm.returns = firm.returns,
X = regressors,
- verbose = FALSE,
- nlags = 1)
+ verbose = FALSE)
+
} else {
## More than one firm
# Extracting and merging
@@ -53,8 +55,8 @@
{
timeseriesAMM(firm.returns = firm.returns[,y],
X = regressors,
- verbose = FALSE,
- nlags = 1)
+ verbose = FALSE)
+
})
names(tmp.resid) <- colnames(firm.returns)
outputModel <- do.call(merge.zoo, tmp.resid)
Modified: pkg/man/eventstudy.Rd
===================================================================
--- pkg/man/eventstudy.Rd 2014-05-16 06:36:20 UTC (rev 358)
+++ pkg/man/eventstudy.Rd 2014-05-16 10:08:22 UTC (rev 359)
@@ -264,7 +264,7 @@
# model arguments
market.returns = OtherReturns[, "NiftyIndex"],
others = OtherReturns[, c("USDINR", "CallMoneyRate")],
- market.returns.purge = TRUE
+ market.returns.purge = TRUE, nlags = 1
)
str(es)
plot(es)
Modified: pkg/vignettes/eventstudies.Rnw
===================================================================
--- pkg/vignettes/eventstudies.Rnw 2014-05-16 06:36:20 UTC (rev 358)
+++ pkg/vignettes/eventstudies.Rnw 2014-05-16 10:08:22 UTC (rev 359)
@@ -19,8 +19,8 @@
\maketitle
-\begin{abstract}
-\end{abstract}
+% \begin{abstract}
+% \end{abstract}
\SweaveOpts{engine=R,pdf=TRUE}
\section{The standard event study in finance}
More information about the Eventstudies-commits
mailing list