[Eventstudies-commits] r138 - pkg/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sat Aug 24 00:07:19 CEST 2013
Author: chiraganand
Date: 2013-08-24 00:07:19 +0200 (Sat, 24 Aug 2013)
New Revision: 138
Modified:
pkg/R/AMM.R
pkg/R/eventstudy.R
Log:
Fixed non-loading of AMM() argument in the environment, changed the
evaluation process, more clean now.
Modified: pkg/R/AMM.R
===================================================================
--- pkg/R/AMM.R 2013-08-20 17:56:27 UTC (rev 137)
+++ pkg/R/AMM.R 2013-08-23 22:07:19 UTC (rev 138)
@@ -7,22 +7,12 @@
AMM <- function(...) {
- # NULLify all the values before use
- firm.returns <- NULL
- market.returns <- NULL
- market.returns.purge <- NULL
- nlags <- NULL
- others <- NULL
- switch.to.innov <- NULL
- verbose <- NULL
- dates <- NULL
-
- # parse the input arguments for the model
+ # extract the arguments for
+ # the model and load into the
+ # current (function's)
+ # environment
modelArgs <- list(...)
- # assign values
- for (i in 1:length(modelArgs)) {
- eval(parse(text = paste(names(modelArgs)[i], "<-", "modelArgs[[i]]")))
- }
+ list2env(list(...), envir = environment())
# Checking required arguments
if (match("market.returns", names(modelArgs), nomatch = -1) == -1) {
Modified: pkg/R/eventstudy.R
===================================================================
--- pkg/R/eventstudy.R 2013-08-20 17:56:27 UTC (rev 137)
+++ pkg/R/eventstudy.R 2013-08-23 22:07:19 UTC (rev 138)
@@ -25,7 +25,7 @@
## AMM
if (type == "AMM") {
amm.type <- "residual"
- tmp.outputModel <- AMM(amm.type, firm.returns = firm.returns, ...)
+ tmp.outputModel <- AMM(amm.type = amm.type, firm.returns = firm.returns, ...)
outputModel <- zoo(coredata(tmp.outputModel),index(tmp.outputModel))
}
More information about the Eventstudies-commits
mailing list