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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Apr 1 14:03:59 CEST 2014


Author: chiraganand
Date: 2014-04-01 14:03:59 +0200 (Tue, 01 Apr 2014)
New Revision: 275

Added:
   pkg/data/NiftyIndex.rda
   pkg/man/NiftyIndex.Rd
Removed:
   pkg/data/nifty.index.rda
   pkg/man/nifty.index.Rd
Modified:
   pkg/inst/tests/test_marketresiduals.R
   pkg/man/excessReturn.Rd
   pkg/man/marketResidual.Rd
   pkg/vignettes/eventstudies.Rnw
Log:
Renamed nifty.index data.

Copied: pkg/data/NiftyIndex.rda (from rev 264, pkg/data/nifty.index.rda)
===================================================================
(Binary files differ)

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

Modified: pkg/inst/tests/test_marketresiduals.R
===================================================================
--- pkg/inst/tests/test_marketresiduals.R	2014-04-01 11:53:22 UTC (rev 274)
+++ pkg/inst/tests/test_marketresiduals.R	2014-04-01 12:03:59 UTC (rev 275)
@@ -4,19 +4,19 @@
 library(eventstudies)
 
 load(system.file("data", "StockPriceReturns.rda", package = "eventstudies"))
-load(system.file("data", "nifty.index.rda", package = "eventstudies"))
+load(system.file("data", "NiftyIndex.rda", package = "eventstudies"))
 
-alldata <- merge(StockPriceReturns, nifty.index, all = TRUE)
-StockPriceReturns <- alldata[,-which(colnames(alldata) %in% "nifty.index")]
-nifty.index <- alldata$nifty.index
+alldata <- merge(StockPriceReturns, NiftyIndex, all = TRUE)
+StockPriceReturns <- alldata[,-which(colnames(alldata) %in% "NiftyIndex")]
+NiftyIndex <- alldata$NiftyIndex
 
 mm.result <- marketResidual(firm.returns=StockPriceReturns[,c("BHEL")],
-                            market.returns=nifty.index)
+                            market.returns=NiftyIndex)
 mm.result <- xts(mm.result[complete.cases(mm.result),])
 colnames(mm.result) <- "BHEL"
 
 # Calculating manually
-result <- lm(BHEL ~ nifty.index, data=StockPriceReturns)
+result <- lm(BHEL ~ NiftyIndex, data=StockPriceReturns)
 resid.res <- xts(result$resid,as.Date(attr(result$resid,"names")))
 colnames(resid.res) <- "BHEL"
 

Copied: pkg/man/NiftyIndex.Rd (from rev 264, pkg/man/nifty.index.Rd)
===================================================================
--- pkg/man/NiftyIndex.Rd	                        (rev 0)
+++ pkg/man/NiftyIndex.Rd	2014-04-01 12:03:59 UTC (rev 275)
@@ -0,0 +1,17 @@
+\name{NiftyIndex}
+\alias{NiftyIndex}
+\docType{data}
+
+\title{NSE Nifty index from 2004 to 2012.}
+
+\description{A sample time series of Nifty index return from 1990 to
+  2012.}
+
+\usage{data(NiftyIndex)}
+
+\format{\pkg{zoo}}
+
+\examples{
+data(NiftyIndex)
+}
+\keyword{datasets}

Modified: pkg/man/excessReturn.Rd
===================================================================
--- pkg/man/excessReturn.Rd	2014-04-01 11:53:22 UTC (rev 274)
+++ pkg/man/excessReturn.Rd	2014-04-01 12:03:59 UTC (rev 275)
@@ -22,9 +22,9 @@
 
 \examples{ 
 data(StockPriceReturns)
-data(nifty.index)
+data(NiftyIndex)
 er.result <- excessReturn(firm.returns = StockPriceReturns,
-			  market.returns = nifty.index)
+			  market.returns = NiftyIndex)
 }
 
 \keyword{excessReturn}

Modified: pkg/man/marketResidual.Rd
===================================================================
--- pkg/man/marketResidual.Rd	2014-04-01 11:53:22 UTC (rev 274)
+++ pkg/man/marketResidual.Rd	2014-04-01 12:03:59 UTC (rev 275)
@@ -22,10 +22,10 @@
 
 \examples{ 
 data(StockPriceReturns)
-data(nifty.index)
+data(NiftyIndex)
 
 mm.result <- marketResidual(firm.returns = StockPriceReturns,
-                            market.returns = nifty.index)
+                            market.returns = NiftyIndex)
 
 }
 

Deleted: pkg/man/nifty.index.Rd
===================================================================
--- pkg/man/nifty.index.Rd	2014-04-01 11:53:22 UTC (rev 274)
+++ pkg/man/nifty.index.Rd	2014-04-01 12:03:59 UTC (rev 275)
@@ -1,17 +0,0 @@
-\name{nifty.index}
-\alias{nifty.index}
-\docType{data}
-
-\title{NSE Nifty index from 2004 to 2012.}
-
-\description{A sample time series of Nifty index return from 1990 to
-  2012.}
-
-\usage{data(nifty.index)}
-
-\format{\pkg{zoo}}
-
-\examples{
-data(nifty.index)
-}
-\keyword{datasets}

Modified: pkg/vignettes/eventstudies.Rnw
===================================================================
--- pkg/vignettes/eventstudies.Rnw	2014-04-01 11:53:22 UTC (rev 274)
+++ pkg/vignettes/eventstudies.Rnw	2014-04-01 12:03:59 UTC (rev 275)
@@ -153,15 +153,15 @@
 
 In this section, we demonstrate the package with a study of the impact of stock splits on the stock prices of firms. We use the returns series of the thirty index companies, as of 2013, of the Bombay Stock Exchange (BSE), between 2001 and 2013.  We also have stock split dates for each firm since 2000. 
 
-Our data consists of a \textit{zoo} object for stock price returns for the thirty firms. This is our ``outcome variable'' of interest, and is called \textit{StockPriceReturns}. Another zoo object, \textit{nifty.index}, contains a time series of market returns. 
+Our data consists of a \textit{zoo} object for stock price returns for the thirty firms. This is our ``outcome variable'' of interest, and is called \textit{StockPriceReturns}. Another zoo object, \textit{NiftyIndex}, contains a time series of market returns. 
 
 <<>>= 
 library(eventstudies) 
 data(StockPriceReturns)
-data(nifty.index) 
+data(NiftyIndex) 
 str(StockPriceReturns) 
 head(StockPriceReturns[rowSums(is.na((StockPriceReturns)))==3,1:3]) 
-head(nifty.index) 
+head(NiftyIndex) 
 @
 
 As required by the package, the event date (the dates on which stock splits occured for these 30 firms) for each firm is recorded in \textit{SplitDates} where ``outcome.unit'' is the name of the firm (the column name in ``StockPriceReturns'') and ``event.date'' is when the event took place for that outcome unit. In R, the column ``outcome.unit'' has to be of class ``character'' and ``event.date'' of class ``Date'', as seen below:
@@ -171,9 +171,9 @@
 head(SplitDates) 
 data(INR) 
 inrusd <- diff(log(INR))*100
-all.data <- merge(StockPriceReturns,nifty.index,inrusd,all=TRUE) 
-StockPriceReturns <- all.data[,-which(colnames(all.data)%in%c("nifty.index", "inr"))] 
-nifty.index <- all.data$nifty.index 
+all.data <- merge(StockPriceReturns,NiftyIndex,inrusd,all=TRUE) 
+StockPriceReturns <- all.data[,-which(colnames(all.data)%in%c("NiftyIndex", "inr"))] 
+NiftyIndex <- all.data$NiftyIndex 
 inrusd <- all.data$inr
 @
 
@@ -188,14 +188,14 @@
 idiosyncratic return estimation that is possible with this package.
 
 <<>>= # Excess return 
-er.result <- excessReturn(firm.returns = StockPriceReturns, market.returns = nifty.index)
+er.result <- excessReturn(firm.returns = StockPriceReturns, market.returns = NiftyIndex)
 er.result <- er.result[rowSums(is.na(er.result))!=NCOL(er.result),]
 head(er.result[,1:3])
 
 @
 
 <<>>= # Extracting market residual
-mm.result <- marketResidual(firm.returns = StockPriceReturns, market.returns = nifty.index)
+mm.result <- marketResidual(firm.returns = StockPriceReturns, market.returns = NiftyIndex)
 mm.result <- mm.result[rowSums(is.na(mm.result))!=NCOL(mm.result),]
 head(mm.result[,1:3])
 
@@ -223,7 +223,7 @@
 ## AMM residuals ##
 ###################
 ## Getting Regressors
-regressors <- makeX(market.returns=nifty.index, others=inrusd, 
+regressors <- makeX(market.returns=NiftyIndex, others=inrusd, 
                     market.returns.purge=TRUE, nlags=1)
 ## AMM residual to time series
 timeseries.lmAMM <- function(firm.returns,X,verbose=FALSE,nlags=1){
@@ -341,19 +341,19 @@
 es.mm <- eventstudy(firm.returns = StockPriceReturns, eventList = SplitDates, 
                     width = 10, to.remap = TRUE, remap = "cumsum", 
                     inference = TRUE, inference.strategy = "bootstrap", 
-                    type = "marketResidual", market.returns = nifty.index) 
+                    type = "marketResidual", market.returns = NiftyIndex) 
 
 ## Event study using excess return and bootstrap 
 es.er <- eventstudy(firm.returns = StockPriceReturns, eventList = SplitDates, 
                     width = 10, to.remap = TRUE, remap = "cumsum", 
                     inference = TRUE, inference.strategy = "bootstrap",
-                    type = "excessReturn", market.returns = nifty.index)
+                    type = "excessReturn", market.returns = NiftyIndex)
 
 ## Event study using augmented market model (AMM) and bootstrap
 es.amm <- eventstudy(firm.returns = StockPriceReturns, eventList = SplitDates, 
                      width = 10, to.remap = TRUE, remap = "cumsum", 
                      inference = TRUE, inference.strategy = "bootstrap", 
-                     type = "lmAMM", market.returns = nifty.index, 
+                     type = "lmAMM", market.returns = NiftyIndex, 
                      others=inrusd, verbose=FALSE, 
                      switch.to.innov=TRUE, market.returns.purge=TRUE, nlags=1)
 print(es.na)



More information about the Eventstudies-commits mailing list