[Eventstudies-commits] r117 - in pkg: R data man vignettes

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Aug 7 14:13:28 CEST 2013


Author: vikram
Date: 2013-08-07 14:13:22 +0200 (Wed, 07 Aug 2013)
New Revision: 117

Modified:
   pkg/R/AMM.R
   pkg/data/StockPriceReturns.rda
   pkg/man/StockPriceReturns.Rd
   pkg/vignettes/eventstudies.Rnw
Log:
Using only one data-set for all examples for consistency

Modified: pkg/R/AMM.R
===================================================================
--- pkg/R/AMM.R	2013-08-07 11:05:59 UTC (rev 116)
+++ pkg/R/AMM.R	2013-08-07 12:13:22 UTC (rev 117)
@@ -171,6 +171,7 @@
    res <- firmExposures(rj,X,verbose=verbose,nlags=nlags)
    exposures <- res$exposure
    sds <- res$s.exposure
+   m.residuals <- xts(res$residuals,as.Date(attr(res$residuals,"names")))
    if(residual==TRUE){
      m.residuals <- xts(res$residuals,as.Date(attr(res$residuals,"names")))
    }
@@ -178,9 +179,9 @@
    tmp <- window(rj,start=dates[1],end=dates[1+1])
    rhs <- window(X,start=dates[1],end=dates[1+1])
    res <- firmExposures(rj=tmp,
-                          X=rhs,
-                          verbose=verbose,
-                          nlags=nlags)
+                        X=rhs,
+                        verbose=verbose,
+                        nlags=nlags)
    exposures[1,] <- res$exposure
    periodnames <- c(periodnames,paste(dates[1],dates[1+1],sep=" TO "))
    sds[1,] <- res$s.exposure

Modified: pkg/data/StockPriceReturns.rda
===================================================================
(Binary files differ)

Modified: pkg/man/StockPriceReturns.Rd
===================================================================
--- pkg/man/StockPriceReturns.Rd	2013-08-07 11:05:59 UTC (rev 116)
+++ pkg/man/StockPriceReturns.Rd	2013-08-07 12:13:22 UTC (rev 117)
@@ -7,7 +7,7 @@
 \title{It is the data-set used for event-study analysis.}
 
 \description{
-It has stock price returns for index constituents of Bombay Stock Exchange (BSE).
+It has stock price returns for index constituents of Bombay Stock Exchange (BSE), nifty index and INR/USD returns.
 }
 
 \usage{data(StockPriceReturns)}

Modified: pkg/vignettes/eventstudies.Rnw
===================================================================
--- pkg/vignettes/eventstudies.Rnw	2013-08-07 11:05:59 UTC (rev 116)
+++ pkg/vignettes/eventstudies.Rnw	2013-08-07 12:13:22 UTC (rev 117)
@@ -190,32 +190,34 @@
 %AMM model
 <<>>=
 # Create RHS before running AMM()
-data("y3c3")
-NIFTY_INDEX <- y3c3$NIFTY_INDEX
-INRUSD <- y3c3$INRUSD
-Company_A <- y3c3$Company_A
-Company_B <- y3c3$Company_B
-Company_C <- y3c3$Company_C
-regressand <- cbind(Company_A,Company_B,Company_C)
+nifty.index <- StockPriceReturns$nifty
+inrusd <- StockPriceReturns$inr
 
 ## AMM output
-## With no structural break dates: dates=NULL
-result1 <- AMM(amm.type="all",rj=y3c3$Company_A,
-           verbose=TRUE,
-           dates= NULL,
-           rM1=y3c3$NIFTY_INDEX, others=y3c3$INRUSD,
-           switch.to.innov=TRUE, rM1purge=TRUE, nlags=1)
+## For Full period: dates=NULL
+amm.residual <- AMM(amm.type="residual",rj=StockPriceReturns[,1:3],
+                    verbose=TRUE,
+                    dates= NULL,
+                    rM1=nifty.index, others=inrusd,
+                    switch.to.innov=TRUE, rM1purge=TRUE, nlags=1)
 
+amm.output <- AMM(amm.type="all",rj=StockPriceReturns[,1:3],
+                  verbose=TRUE,
+                  dates= NULL,
+                  rM1=nifty.index, others=inrusd,
+                  switch.to.innov=TRUE, rM1purge=TRUE, nlags=1)
 
 
-## With AMM different structural periods  
-result2 <- AMM(amm.type="all",rj=Company_A,
-               nlags=NA,
-               verbose=TRUE,
-               dates= as.Date(c("2005-01-15","2006-01-07","2007-01-06",
-                 "2008-01-05","2009-01-03")),
-               rM1=NIFTY_INDEX, others=INRUSD,
-               switch.to.innov=TRUE, rM1purge=TRUE, nlags=1)
+## ## With AMM different structural periods  
+## structural.break.dates <- c(start(StockPriceReturns),as.Date("2007-01-06"),
+##                             end(StockPriceReturns))
+## amm.output.different.periods <- AMM(amm.type = "all",rj = StockPriceReturns[,1],
+##                                     nlags = NA,
+##                                     verbose =TRUE,
+##                                     dates = structural.break.dates,
+##                                     rM1 = nifty.index, others = inrusd,
+##                                     switch.to.innov = TRUE, rM1purge = TRUE, 
+##                                     nlags = 1)
 
 @ 
 
@@ -342,13 +344,8 @@
                     type = "excessReturn", market.name = "nifty")
 
 ## Event study using augmented market model (AMM) and bootstrap
-data(inr)
-inrusd <- zoo(diff(log(inr))*100,index(inr))
-all.data <- merge(StockPriceReturns,inrusd, all = FALSE)
-all.data <- window(all.data, start="2004-01-01")
-all.data <- all.data[-which(is.na(all.data$nifty)),]
-cn.names <- which(colnames(all.data)%in%c("nifty","inr"))
-stock.data <- all.data[,-cn.names]
+cn.names <- which(colnames(StockPriceReturns)%in%c("nifty","inr"))
+stock.data <- StockPriceReturns[,-cn.names]
 
 es.amm <- eventstudy(inputData = stock.data, 
                      eventList = SplitDates, 
@@ -356,7 +353,7 @@
                      to.plot = TRUE, inference = TRUE, 
                      inference.strategy = "bootstrap",
                      type = "AMM", amm.type="residual",
-                     rM1=all.data$nifty, others=all.data$inr,
+                     rM1=StockPriceReturns$nifty, others=StockPriceReturns$inr,
                      nlags=1, verbose=TRUE,
                      dates= NULL,
                      switch.to.innov=TRUE, rM1purge=TRUE, nlags=1)



More information about the Eventstudies-commits mailing list