[Eventstudies-commits] r94 - in pkg: . R data inst/tests man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Jul 16 15:55:56 CEST 2013


Author: chiraganand
Date: 2013-07-16 15:55:56 +0200 (Tue, 16 Jul 2013)
New Revision: 94

Added:
   pkg/data/firmExposuresData.rda
   pkg/data/mmData.rda
   pkg/man/mmData.Rd
   pkg/man/y3c3.Rd
Removed:
   pkg/data/firmExposures.rda
   pkg/data/marketmodelData.rda
   pkg/man/ammData.Rd
Modified:
   pkg/DESCRIPTION
   pkg/NAMESPACE
   pkg/R/AMM.R
   pkg/R/eventstudy.R
   pkg/inst/tests/test_AMM.R
   pkg/man/AMM.Rd
   pkg/man/excessReturn.Rd
   pkg/man/firmExposures.Rd
   pkg/man/firmExposuresData.Rd
   pkg/man/makeX.Rd
   pkg/man/manyfirmsAMM.Rd
   pkg/man/marketResidual.Rd
   pkg/man/onefirmAMM.Rd
Log:
Lots of changes, R CMD checks passing now.

Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION	2013-07-16 11:20:57 UTC (rev 93)
+++ pkg/DESCRIPTION	2013-07-16 13:55:56 UTC (rev 94)
@@ -4,7 +4,7 @@
 Version: 1.1
 Author: Ajay Shah, Vimal Balasubramaniam, Vikram Bahure
 Maintainer: Vikram Bahure <economics.vikram at gmail.com>
-Depends: R (>= 2.12.0), zoo, xts, boot, testthat
+Depends: R (>= 2.12.0), zoo, xts, boot, testthat, sandwich
 Description: Implementation of short and long term event study methodology
 License: GPL-2
 LazyLoad: yes

Modified: pkg/NAMESPACE
===================================================================
--- pkg/NAMESPACE	2013-07-16 11:20:57 UTC (rev 93)
+++ pkg/NAMESPACE	2013-07-16 13:55:56 UTC (rev 94)
@@ -1,4 +1,7 @@
 export(inference.Ecar, phys2eventtime, remap.cumsum, remap.cumprod, remap.event.reindex, ees, eesPlot)
+export(marketResidual,
+       excessReturn
+       )
 export(AMM,
        onefirmAMM,
        manyfirmsAMM,

Modified: pkg/R/AMM.R
===================================================================
--- pkg/R/AMM.R	2013-07-16 11:20:57 UTC (rev 93)
+++ pkg/R/AMM.R	2013-07-16 13:55:56 UTC (rev 94)
@@ -96,7 +96,7 @@
 #######################
 # AMM for one firm
 #######################
-onefirmAMM <- function(rj,X,nlags=NA,verbose=FALSE,dates=NULL,residual=FALSE){
+onefirmAMM <- function(rj,X,nlags=NA,verbose=FALSE,dates=NULL,residual=TRUE){
   exposures <- data.frame(matrix(NA,ncol=ncol(X),nrow=(length(dates)-1)))
   colnames(exposures) <- colnames(X)
   sds <- exposures

Modified: pkg/R/eventstudy.R
===================================================================
--- pkg/R/eventstudy.R	2013-07-16 11:20:57 UTC (rev 93)
+++ pkg/R/eventstudy.R	2013-07-16 13:55:56 UTC (rev 94)
@@ -1,13 +1,13 @@
 eventstudy <- function(inputData = NULL,
                        eventList,
                        width = 10,
-                       type = "marketResiduals",
+                       type = "marketResidual",
                        to.remap = TRUE,
                        remap = "cumsum",
                        to.plot = TRUE,
                        levels =  FALSE,
                        ...) {
-                                        # type = "marketResiduals", "excessReturn", "AMM", "None"
+                                        # type = "marketResidual", "excessReturn", "AMM", "None"
   if (type == "None" && !is.null(inputData)) {
     outputModel <- inputData
   } else {
@@ -24,9 +24,9 @@
     outputModel <- AMM(...)
   }
 
-  ## marketResiduals
-  if (type == "marketResiduals") {
-    outputModel <- marketResiduals(...)
+  ## marketResidual
+  if (type == "marketResidual") {
+    outputModel <- marketResidual(...)
   }
 
   ## excessReturn

Deleted: pkg/data/firmExposures.rda
===================================================================
(Binary files differ)

Copied: pkg/data/firmExposuresData.rda (from rev 86, pkg/data/firmExposures.rda)
===================================================================
(Binary files differ)

Deleted: pkg/data/marketmodelData.rda
===================================================================
(Binary files differ)

Copied: pkg/data/mmData.rda (from rev 86, pkg/data/marketmodelData.rda)
===================================================================
(Binary files differ)

Modified: pkg/inst/tests/test_AMM.R
===================================================================
--- pkg/inst/tests/test_AMM.R	2013-07-16 11:20:57 UTC (rev 93)
+++ pkg/inst/tests/test_AMM.R	2013-07-16 13:55:56 UTC (rev 94)
@@ -1,14 +1,12 @@
 context("AMM")
 
 test_that("test.AMM", {
-  library(sandwich)
-  
-  load(system.file("data", "firmExposures.rda", package = "eventstudies"))
+  load(system.file("data", "firmExposuresData.rda", package = "eventstudies"))
 
-  rj  <- firmExposures$Company_A
-  rM1 <- firmExposures$NIFTY_INDEX
-  rM2 <- firmExposures$usdinr
-  rM3 <- firmExposures$baa
+  rj  <- firmExposuresData$Company_A
+  rM1 <- firmExposuresData$NIFTY_INDEX
+  rM2 <- firmExposuresData$usdinr
+  rM3 <- firmExposuresData$baa
 
   cat("\nDoing Testcase P2")
   X <- makeX(rM1, others=rM2,

Modified: pkg/man/AMM.Rd
===================================================================
--- pkg/man/AMM.Rd	2013-07-16 11:20:57 UTC (rev 93)
+++ pkg/man/AMM.Rd	2013-07-16 13:55:56 UTC (rev 94)
@@ -7,16 +7,17 @@
 }
 
 \usage{
-AMM(amm.type=c("one.firm","manyfirms","firmExposures"), ...)
+AMM(amm.type=NULL, ...)
 }
 
 \arguments{
-  \item{amm.type}{Type of AMM to be performed: On one firm or many firms or just firm exposure}
-
+  \item{amm.type}{Type of AMM to be performed: On one firm "onefirm" or
+    just firm exposure "firmExposures"}
+  \item{...}{Accepts specific arguments for the model.}
 }
-\value{ The function returns the exposures, HAC adjusted standard
+\value{The function returns the exposures, HAC adjusted standard
   errors, the number of lags used, and the residuals from the fitted
-  model.
+  model. Default is NULL.
 
 \item{exposures}{This contains the exposure estimates for the firm
 j}
@@ -37,7 +38,7 @@
 
 \examples{ 
 # Create RHS before running AMM()
-data("ammData")
+data("y3c3")
 NIFTY_INDEX <- y3c3$NIFTY_INDEX
 INRUSD <- y3c3$INRUSD
 Company_A <- y3c3$Company_A
@@ -53,15 +54,6 @@
                        "2008-01-05","2009-01-03")),
            rM1=NIFTY_INDEX, others=INRUSD,
            switch.to.innov=TRUE, rM1purge=TRUE, nlags=1)
-
-# Many firm
-mf<- AMM(amm.type="manyfirm",regressand,
-            lags=NA, nlags=NA,
-            verbose=TRUE,
-            dates= as.Date(c("2005-01-15","2006-01-07","2007-01-06",
-                       "2008-01-05","2009-01-03")),periodnames=c("P1","P2","P3","P4"),
-           rM1=NIFTY_INDEX, others=INRUSD,
-           switch.to.innov=TRUE, rM1purge=TRUE)
 }
 
 \keyword{AMM}
\ No newline at end of file

Deleted: pkg/man/ammData.Rd
===================================================================
--- pkg/man/ammData.Rd	2013-07-16 11:20:57 UTC (rev 93)
+++ pkg/man/ammData.Rd	2013-07-16 13:55:56 UTC (rev 94)
@@ -1,17 +0,0 @@
-\name{ammData}
-\alias{ammData}
-
-
-\title{Three years and three random companies}
-
-\description{Data for testing and examples in the package}
-
-\usage{data(ammData)}
-
-\examples{
-library(zoo)
-data(ammData)
-str(y3c3)
-}
-
-\keyword{ammData}
\ No newline at end of file

Modified: pkg/man/excessReturn.Rd
===================================================================
--- pkg/man/excessReturn.Rd	2013-07-16 11:20:57 UTC (rev 93)
+++ pkg/man/excessReturn.Rd	2013-07-16 13:55:56 UTC (rev 94)
@@ -15,12 +15,12 @@
   \item{market.name}{It is the market (index) column name in the data object}
 
 }
-\value{ Excess market return}
+\value{Excess market return}
 
 \author{Vikram Bahure}
 
 \examples{ 
-data(marketmodelData)
+data(mmData)
 er.result <- excessReturn(firm.name="ranbaxyacp",market.name="nifty",
                           data.object=mmData)
 

Modified: pkg/man/firmExposures.Rd
===================================================================
--- pkg/man/firmExposures.Rd	2013-07-16 11:20:57 UTC (rev 93)
+++ pkg/man/firmExposures.Rd	2013-07-16 13:55:56 UTC (rev 94)
@@ -59,10 +59,10 @@
 \examples{
 # firmExposures
 data("firmExposuresData")
-rj  <- test$Company_A
-rM1 <- test$NIFTY_INDEX
-rM2 <- test$usdinr
-rM3 <- test$baa
+rj  <- firmExposuresData$Company_A
+rM1 <- firmExposuresData$NIFTY_INDEX
+rM2 <- firmExposuresData$usdinr
+rM3 <- firmExposuresData$baa
 X <- makeX(rM1, others=rM2,
            switch.to.innov=FALSE, rM1purge=FALSE, verbose=FALSE)
 a <- firmExposures(rj, X, nlags=0, verbose=FALSE)

Modified: pkg/man/firmExposuresData.Rd
===================================================================
--- pkg/man/firmExposuresData.Rd	2013-07-16 11:20:57 UTC (rev 93)
+++ pkg/man/firmExposuresData.Rd	2013-07-16 13:55:56 UTC (rev 94)
@@ -13,7 +13,7 @@
 \examples{
 library(zoo)
 data(firmExposuresData)
-str(test)
+str(firmExposuresData)
 }
 
 \keyword{firmExposuresData}
\ No newline at end of file

Modified: pkg/man/makeX.Rd
===================================================================
--- pkg/man/makeX.Rd	2013-07-16 11:20:57 UTC (rev 93)
+++ pkg/man/makeX.Rd	2013-07-16 13:55:56 UTC (rev 94)
@@ -11,7 +11,7 @@
 }
 
 \usage{
-makeX(rM1, others, switch.to.innov = rep(TRUE, NCOL(others)), rM1purge = TRUE, nlags = 5, dates = NULL, verbose = TRUE)
+makeX(rM1, others, switch.to.innov = rep(TRUE, NCOL(others)), rM1purge = TRUE, nlags = 5, dates = NULL, verbose = FALSE)
 }
 
 \arguments{
@@ -61,18 +61,15 @@
 
 \author{Ajay Shah, Vimal Balasubramaniam}
 
-\seealso{ \code{\link{do.one.piece}}}
-
 \examples{
 # makeX
 data("firmExposuresData")
-rj  <- test$Company_A
-rM1 <- test$NIFTY_INDEX
-rM2 <- test$usdinr
-rM3 <- test$baa
+rj  <- firmExposuresData$Company_A
+rM1 <- firmExposuresData$NIFTY_INDEX
+rM2 <- firmExposuresData$usdinr
+rM3 <- firmExposuresData$baa
 X <- makeX(rM1, others=rM2,
            switch.to.innov=FALSE, rM1purge=FALSE, verbose=FALSE)
 }
 
 \keyword{makeX}
-\keyword{do.one.piece}
\ No newline at end of file

Modified: pkg/man/manyfirmsAMM.Rd
===================================================================
--- pkg/man/manyfirmsAMM.Rd	2013-07-16 11:20:57 UTC (rev 93)
+++ pkg/man/manyfirmsAMM.Rd	2013-07-16 13:55:56 UTC (rev 94)
@@ -43,7 +43,7 @@
 \examples{
 # Running manyfirmsAMM() involves as many steps as working with onefirmAMM. 
 
-data("ammData",package="amm")       
+data("y3c3", package="eventstudies")       
 NIFTY_INDEX <- y3c3$NIFTY_INDEX
 INRUSD <- y3c3$INRUSD
 Company_A <- y3c3$Company_A

Modified: pkg/man/marketResidual.Rd
===================================================================
--- pkg/man/marketResidual.Rd	2013-07-16 11:20:57 UTC (rev 93)
+++ pkg/man/marketResidual.Rd	2013-07-16 13:55:56 UTC (rev 94)
@@ -22,7 +22,7 @@
 \author{Vikram Bahure}
 
 \examples{ 
-data(marketmodelData)
+data(mmData)
 # Forumla for market model
 mm.formula <- paste("ranbaxyacp","~","nifty","+","drug",sep="")
 # Extracting market residual

Added: pkg/man/mmData.Rd
===================================================================
--- pkg/man/mmData.Rd	                        (rev 0)
+++ pkg/man/mmData.Rd	2013-07-16 13:55:56 UTC (rev 94)
@@ -0,0 +1,19 @@
+\name{mmData}
+\alias{mmData}
+
+
+\title{Data for testing the market model and examples therein}
+
+\description{This is a zoo data that is used for testing purposes}
+
+\usage{data(mmData)}
+
+\author{Vikram Bahure}
+
+\examples{
+library(zoo)
+data(mmData)
+str(mmData)
+}
+
+\keyword{mmData}
\ No newline at end of file

Modified: pkg/man/onefirmAMM.Rd
===================================================================
--- pkg/man/onefirmAMM.Rd	2013-07-16 11:20:57 UTC (rev 93)
+++ pkg/man/onefirmAMM.Rd	2013-07-16 13:55:56 UTC (rev 94)
@@ -10,7 +10,7 @@
 }
 
 \usage{
-onefirmAMM(rj, X, nlags = NA, verbose = FALSE, dates)
+onefirmAMM(rj, X, nlags = NA, verbose = FALSE, dates = NULL, residual = TRUE)
 }
 
 \arguments{
@@ -29,7 +29,9 @@
   }
   \item{dates}{Default is NULL. If no dates are mentioned, onefirmAMM does
   what firmExposures() would do, i.e., estimate exposures for the full time period.
-  } 
+  }
+  \item{residual}{Returns AMM Residuals if TRUE, AMM exposure
+  otherwise. Defaults to TRUE.}
 }
 \value{ The function returns the exposures, HAC adjusted standard
   errors, the number of lags used, and the residuals from the fitted
@@ -42,7 +44,7 @@
 
 \examples{ 
 # Create RHS before running onefirmAMM()
-data("ammData")
+data("y3c3")
 NIFTY_INDEX <- y3c3$NIFTY_INDEX
 INRUSD <- y3c3$INRUSD
 Company_A <- y3c3$Company_A

Copied: pkg/man/y3c3.Rd (from rev 86, pkg/man/ammData.Rd)
===================================================================
--- pkg/man/y3c3.Rd	                        (rev 0)
+++ pkg/man/y3c3.Rd	2013-07-16 13:55:56 UTC (rev 94)
@@ -0,0 +1,17 @@
+\name{y3c3}
+\alias{y3c3}
+
+
+\title{Three years and three random companies}
+
+\description{Data for testing and examples in the package}
+
+\usage{data(y3c3)}
+
+\examples{
+library(zoo)
+data(y3c3)
+str(y3c3)
+}
+
+\keyword{y3c3}
\ No newline at end of file



More information about the Eventstudies-commits mailing list