[Eventstudies-commits] r125 - in pkg: inst/tests man vignettes

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Aug 9 20:13:17 CEST 2013


Author: vikram
Date: 2013-08-09 20:13:16 +0200 (Fri, 09 Aug 2013)
New Revision: 125

Modified:
   pkg/inst/tests/test_inr_inference.R
   pkg/man/eventstudy.Rd
   pkg/man/excessReturn.Rd
   pkg/man/firmExposures.Rd
   pkg/vignettes/eventstudies.Rnw
Log:
Modified test inr test case for new inr data; corrected documentation for new changes in the function

Modified: pkg/inst/tests/test_inr_inference.R
===================================================================
--- pkg/inst/tests/test_inr_inference.R	2013-08-09 12:54:27 UTC (rev 124)
+++ pkg/inst/tests/test_inr_inference.R	2013-08-09 18:13:16 UTC (rev 125)
@@ -19,13 +19,27 @@
 event_time_data <- phys2eventtime(inr_returns,eventslist,width=10)
 w <- window(event_time_data$z.e,start=-10,end=10)
 
-expect_that(inference.bootstrap(w)[,2],
-            equals(c(-0.00215361156303362, -0.00040191670837042, 0.00171845148444985, 
-                     0.00143799970419951, 0.00149260146357282, -0.00284892904228684, 
-                     0.0013220811191847, -0.000634983205805195, 0.00115930378269389, 
-                     -0.000508755768685365, -0.00190621828611177, 0.000128303517790052, 
-                     -0.000547070723466092, 0.000463708708964017, -0.00108666428087325, 
-                     -0.00121321855159642, 0.00216769754166339, -0.000166340225607797, 
-                     0.00117626759805196, 0.000207307545758795, 0.000602629204764948
-                     )))
+expect_that(inference.bootstrap(w, to.plot=FALSE)[,2],
+            equals(c(-0.000015327455,
+                     -0.002526819039,
+                     0.001190000495,
+                     0.001193534934,
+                     0.001846733711,
+                     -0.000105473215,
+                     -0.001659771669,
+                     0.001644517771,
+                     -0.001325235918,
+                     0.001546368579,
+                     -0.000809734240,
+                     -0.001499191073,
+                     -0.000289413740,
+                     -0.000003273428,
+                     -0.000416661873,
+                     -0.001150000190,
+                     -0.000759748390,
+                     0.002306711019,
+                     -0.0004872993296,
+                     0.001122457470,
+                     0.000635889955)))
 })
+

Modified: pkg/man/eventstudy.Rd
===================================================================
--- pkg/man/eventstudy.Rd	2013-08-09 12:54:27 UTC (rev 124)
+++ pkg/man/eventstudy.Rd	2013-08-09 18:13:16 UTC (rev 125)
@@ -7,7 +7,7 @@
 }
 
 \usage{
-eventstudy(inputData = NULL,
+eventstudy(firm.returns = NULL,
            eventList,
            width = 10,
            is.levels =  FALSE,
@@ -23,7 +23,7 @@
 }
 
 \arguments{
-  \item{inputData}{Data on which event study is to be performed}
+  \item{firm.returns}{Data on which event study is to be performed}
   \item{eventList}{A data frame with event dates. It has two columns 'unit' and 'when'. The first column 'unit' consists of column names of the event stock and 'when' is the respective event date}
   \item{width}{It studies the performance of observations before and after the event}
   \item{type}{This argument gives an option to use different market model adjustment like "marketResidual", "excessReturn", "AMM" and "None"}
@@ -65,7 +65,7 @@
 ## data("SplitDates")
 
 ## Event study without adjustment
-## es <- eventstudy(inputData = StockPriceReturns, eventList = SplitDates, width = 10,type = "None", to.remap = TRUE, remap = "cumsum", to.plot = FALSE,inference = TRUE, inference.strategy = "bootstrap")
+## es <- eventstudy(firm.returns = StockPriceReturns, eventList = SplitDates, width = 10,type = "None", to.remap = TRUE, remap = "cumsum", to.plot = FALSE,inference = TRUE, inference.strategy = "bootstrap")
 
 }
 

Modified: pkg/man/excessReturn.Rd
===================================================================
--- pkg/man/excessReturn.Rd	2013-08-09 12:54:27 UTC (rev 124)
+++ pkg/man/excessReturn.Rd	2013-08-09 18:13:16 UTC (rev 125)
@@ -3,10 +3,10 @@
 
 \title{A function that estimates excess return}
 
-\description{ This function estimates excess return. If the the firm return is rj and market return is rM then output will be rj less rM.
+\description{ This function estimates excess return. If the the firm return is rj and market return is market.returns then output will be firm.returns less market.returns.
 }
 
-\usage{excessReturn(firm.returns, market.returns)
+\usage{excessReturn(firm.returns, market.returns)}
 
 \arguments{
   \item{firm.returns}{Firm returns of which excess return from market is to be calculated}

Modified: pkg/man/firmExposures.Rd
===================================================================
--- pkg/man/firmExposures.Rd	2013-08-09 12:54:27 UTC (rev 124)
+++ pkg/man/firmExposures.Rd	2013-08-09 18:13:16 UTC (rev 125)
@@ -4,18 +4,18 @@
 \title{A function that estimates exposure for a single firm in a
 single period}
 
-\description{This function typically utilises an rj vector
+\description{This function typically utilises an firm.returns vector
   and an X matrix of explanatory variables obtained 
   using the makeX function. This would compute the exposure
   for all columns in X.
 }
 
 \usage{
-firmExposures(rj, X, nlags = NA, verbose = FALSE)
+firmExposures(firm.returns, X, nlags = NA, verbose = FALSE)
 }
 
 \arguments{
-  \item{rj}{A vector of data for one firm}
+  \item{firm.returns}{A vector of data for one firm}
 
   \item{X}{A matrix of explanatory variables obtained from
     the makeX function. The first variable is always the
@@ -42,7 +42,7 @@
 j}
 
 \item{s.exposures}{This contains the HAC adjusted standard error
-of the exposures estimated for the firm rj.}
+of the exposures estimated for the firm firm.returns.}
 
 \item{nlags}{Specifies the lag length provided by the user}
 
@@ -59,13 +59,13 @@
 \examples{
 # firmExposures
 data("firmExposuresData")
-rj  <- firmExposuresData$Company_A
+firm.returns  <- firmExposuresData$Company_A
 market.returns <- firmExposuresData$NIFTY_INDEX
 rM2 <- firmExposuresData$usdinr
 rM3 <- firmExposuresData$baa
 X <- makeX(market.returns, others=rM2,
            switch.to.innov=FALSE, market.returns.purge=FALSE, verbose=FALSE)
-a <- firmExposures(rj, X, nlags=0, verbose=FALSE)
+a <- firmExposures(firm.returns, X, nlags=0, verbose=FALSE)
 print(a)
 }
 

Modified: pkg/vignettes/eventstudies.Rnw
===================================================================
--- pkg/vignettes/eventstudies.Rnw	2013-08-09 12:54:27 UTC (rev 124)
+++ pkg/vignettes/eventstudies.Rnw	2013-08-09 18:13:16 UTC (rev 125)
@@ -158,7 +158,7 @@
    \item \texttt{inference.wilcox}: estimation of wilcox inference to
      generate the distribution of cumulative returns series.
    \end{itemize}
-\end{enumerate}
+%\end{enumerate}
 
      
 \section{Example: Performing Eventstudy analysis} 
@@ -178,6 +178,7 @@
 <<>>=
 library(eventstudies)
 data(StockPriceReturns)
+data(nifty.index)
 str(StockPriceReturns)
 head(StockPriceReturns)
 @ 
@@ -193,14 +194,14 @@
 # Excess return
 er.result <- excessReturn(firm.returns = StockPriceReturns,
                           market.returns = nifty.index)
-head(er.result)
+head(er.result[,1:3])
 
 @ 
 <<>>=
 # Extracting market residual
 mm.result <- marketResidual(firm.returns = StockPriceReturns, 
                             market.returns = nifty.index)
-head(mm.result)
+head(mm.result[,1:3])
 
 @ 
 
@@ -365,9 +366,6 @@
                     type = "excessReturn", market.returns = nifty.index)
 
 ## Event study using augmented market model (AMM) and bootstrap
-cn.names <- which(colnames(StockPriceReturns)%in%c("nifty","inr"))
-stock.data <- StockPriceReturns[,-cn.names]
-
 es.amm <- eventstudy(firm.returns = StockPriceReturns, 
                      eventList = SplitDates, 
                      width = 10, to.remap = TRUE, remap = "cumsum", 



More information about the Eventstudies-commits mailing list