[Eventstudies-commits] r126 - pkg/vignettes

Mon Aug 12 11:45:00 CEST 2013

Author: renukasane
Date: 2013-08-12 11:45:00 +0200 (Mon, 12 Aug 2013)
New Revision: 126

Modified:
pkg/vignettes/eventstudies.Rnw
Log:
Vignette - work in progress.

Modified: pkg/vignettes/eventstudies.Rnw
===================================================================
--- pkg/vignettes/eventstudies.Rnw	2013-08-09 18:13:16 UTC (rev 125)
+++ pkg/vignettes/eventstudies.Rnw	2013-08-12 09:45:00 UTC (rev 126)
@@ -112,12 +112,15 @@
The package offers the following functionalities:
\begin{itemize}
\item Models for calculating returns
- \item Coverting data to event-frame and remapping event-frame
+ \item Procedures for coverting data to event-time and remapping
+   event-frame
\item Procedures for inference
\end{itemize}

\subsection*{Models for calculating returns}
-
+The package offers three models for calculating returns. These include
+the excess return model, the standard market model, and the augmented
+market model. The models are accessed using the following functions:
\begin{itemize}
\item \texttt{excessReturn}: estimation of excess return i.e. $R_j - R_m$ where $R_j$ is the return of firm $j$ and $R_m$ is the market
@@ -125,42 +128,44 @@
\item \texttt{marketResidual}: estimation of market residual after
extracting market returns from firm returns.

-     The first argument of the two functions is the \texttt{data.oject}
-     which is a time-series of stock returns. The second argument is
-     \texttt{market.name}, a column name indicating market returns.
-
\item \texttt{AMM}: estimation of the Augmented market model which
gives the market residual after extracting market returns and
currency returns from firm returns. The function allows for
specifying the type of the AMM model as well.
\end{itemize}

+  The two common arguments for these functions are
+  \texttt{firm.returns} which is a time-series of stock returns, and
+  \texttt{market.returns}, which is a time-series of market
+  returns. The type of AMM model is specified with the option
+  \texttt{amm.type}.
+
The output from these models is another time-series object which is
used for converting to event time.

-  \subsection*{Coverting the data-set to an event frame}
-  These include:
-   \begin{itemize}
-   \item \texttt{phys2eventtime}: conversion to an event frame. This
-     requires a time series object of stock price returns and an
-     object with two columns \textit{unit} and \textit{when}, the date
-     of occurrence of the event.
-
-   \item \texttt{remap.cumsum}: conversion of returns to cumulative
-     returns
-   \end{itemize}
+\subsection*{Coverting the data-set to an event time}
+The conversion of the returns data to event-time, and to cumulative
+returns is done using the following functions:
+\begin{itemize}
+ \item \texttt{phys2eventtime}: conversion to an event frame. This
+   requires a time series object of stock price returns and an
+   object with two columns \textit{unit} and \textit{when}, the date
+   of occurrence of the event.

-  \subsection*{Procedures for inference}
-  These include:
-   \begin{itemize}
-   \item \texttt{inference.bootstrap}: estimation of bootstrap to
-     generate the distribution of  cumulative returns series.
-   \item \texttt{inference.wilcox}: estimation of wilcox inference to
-     generate the distribution of cumulative returns series.
-   \end{itemize}
-%\end{enumerate}
+ \item \texttt{remap.cumsum}: conversion of returns to cumulative
+   returns. The input for this function is the time-series data in
+   event-time that results from using \texttt{phys2eventtime}.
+\end{itemize}

-
+\subsection*{Procedures for inference}
+Two procedures for inference are provided. These include:
+\begin{itemize}
+ \item \texttt{inference.bootstrap}: estimation of bootstrap to
+   generate the distribution of  cumulative returns series.
+ \item \texttt{inference.wilcox}: estimation of wilcox inference to
+   generate the distribution of cumulative returns series.
+\end{itemize}
+
\section{Example: Performing Eventstudy analysis}
\label{s:example}

@@ -170,10 +175,9 @@
Exchange (BSE), from 2001 to 2013.  We have stock split dates for each
firm from 2000 onwards.

-We first create a \textit{zoo} object for stock price returns for the
-thirty firms. This is called \textit{StockPriceReturns}. The column
-\texttt{nifty} is the market return and \texttt{inr} the INR-USD
-exchange rate.
+Our data consists of a \textit{zoo} object for stock price returns for
+the thirty firms. This is called \textit{StockPriceReturns} and
+another zoo object, \textit{nifty.index}, of the market returns.

<<>>=
library(eventstudies)
@@ -181,14 +185,15 @@
data(nifty.index)
str(StockPriceReturns)
@

\subsection{Calculating returns}

The function \texttt{excessReturn} calculates the excess returns while
-\texttt{marketResidual} calculates the market model. It requires the
-user to specify the \texttt{market.name} and \texttt{data.object}. The
-result is stored in \texttt{er.result}.
+\texttt{marketResidual} calculates the market model. The two inputs
+are \texttt{firm.returns} and \texttt{market.returns}. The results are
+stored in \texttt{er.result} and \texttt{mm.result} respectively.

<<>>=
# Excess return
@@ -205,6 +210,17 @@

@

+The \texttt{AMM} model requires a time-series of the exchange rate
+along with firm returns and market returns. This is done by loading
+the \textit{inr} data, which is the INR-USD exchange rate for the same
+period. The complete data-set consisting of stock returns, market
+returns, and exchange rate is first created.
+
+The inputs into the \texttt{AMM} model also include
+\texttt{firm.returns} and \texttt{market.returns}. Currency returns
+can be specified using \texttt{others}. Two types of the AMM model are
+supported: \textit{residual} and \textit{all}.
+
%AMM model
<<>>=
# Create RHS before running AMM()
@@ -233,26 +249,39 @@

@

-
\subsection{Conversion to event frame}

-Before the data is converted to event frame, we need to know the dates
-of interest. This is done with a data frame with two columns
-\textit{unit} and \textit{when}. \textit{unit} has name of
-the response series (firm name as in column name of time series
-object) along with event date in \textit{when}. \textit{unit} should
-be in \textit{character} format and \textit{when} in \textit{Date}
-format.
+Before the returns data is converted to event-time, we need to know
+the dates of interest. These are stored in a data frame,
+\texttt{SplitDates} with two columns \textit{unit} and
+\textit{when}. \textit{unit} has the name of the response series (firm
+name for example) along with event date in
+\textit{when}. \textit{unit} should be in \textit{character} format
+and \textit{when} in \textit{Date} format.

<<>>=
data(SplitDates)
@

+For conversion to event time, the event date and the returns on that
+date are indexed to 0. Post-event dates are indexed as positive, and
+pre-event dates as negative. This is done using the
+\texttt{phys2eventtime} function. The function requires a returns
+series, \textit{StockPriceReturns}, a data-frame with event unit
+and time, \textit{SplitDates}, and the \texttt{width} for creating the
+event-frame.

-The event date and the returns on that date are indexed to
-0. Post-event dates are indexed to positive, and pre-event dates as
-negative. This is done using the \texttt{phys2eventtime} function.
+<<>>=
+es <- phys2eventtime(z=StockPriceReturns, events=SplitDates, width=10)
+str(es)
+es$outcomes +es.w <- window(es$z.e, start=-10, end=10)
+colnames(es.w) <- SplitDates[which(es$outcomes=="success"),1] +SplitDates[1,] +StockPriceReturns[SplitDates[1,2],SplitDates[1,1]] +es.w[,1] +@ The output for \texttt{phys2eventtime} is a list. The first element of a list is a time series object which is converted to event @@ -265,24 +294,13 @@ the span of data for the unit or \textit{unitmissing} if a unit named in events is not in \textit{z}. -<<>>= -es <- phys2eventtime(z=StockPriceReturns, events=SplitDates, width=10) -str(es) -es$outcomes
-es.w <- window(es$z.e, start=-10, end=10) -colnames(es.w) <- SplitDates[which(es$outcomes=="success"),1]
-SplitDates[1,]
-StockPriceReturns[SplitDates[1,2],SplitDates[1,1]]
-es.w[,1]
-@
+In the example described here, es.w contains the returns in event-time
+form for all the stocks. It contains variables for whom all data is
+available.

-In this example, es.w contains the returns in event-time form for all
-the stocks. In this you only get variables for whom all data is
-available.
+Once the returns are converted to event-time, \texttt{remap.cumsum}
+function is used to convert the returns to cumulative returns.

-In event study analysis the variable of interest is cumulative
-returns. The \texttt{remap.cumsum} function is used to convert the
-returns to cumulative returns.
<<>>=
es.cs <- remap.cumsum(es.w,is.pc=FALSE,base=0)
es.cs[,1]
@@ -290,18 +308,19 @@

\subsection{Inference procedures}
\subsubsection{Bootstrap inference}
-After converting to event frame and estimating the interest variable,
+
+After converting to event frame and estimating the interest variable,
we need to check the stability of the result and derive other
estimates like standard errors and confidence intervals. For this,
we generate the sampling distribution for the estimate using bootstrap
inference. A detailed explanation of the methodology is presented in
-Patnaik, Shah and Singh (2013).
-This specific approach used here is based on
-\citet{davison1986efficient}. The \textit{inference.bootstrap} function
-does the bootstrap to generate distribution of $\bar{CR}$. The
-bootstrap generates confidence interval at 2.5\% and 97.5\% for the
-estimate.
+Patnaik, Shah and Singh (2013). This specific approach used here is based on
+\citet{davison1986efficient}.

+The \textit{inference.bootstrap} function does the bootstrap to
+generate distribution of $\bar{CR}$. The bootstrap generates
+confidence interval at 2.5\% and 97.5\% for the estimate.
+
<<>>=
result <- inference.bootstrap(es.w=es.cs, to.plot=TRUE)
@
@@ -318,8 +337,9 @@
\label{fig:one}
\end{figure}

-\subsubsection{Wilcoxon signed rank tests}
-It is a non-parametric inference test to compute confidence interval.
+\subsubsection{Wilcoxon signed rank test}
+We next compute the Wilcoxon signed rank test, which is a
+non-parametric inference test to compute confidence interval.
<<>>=
result <- inference.wilcox(es.w=es.cs, to.plot=TRUE)
@
@@ -337,12 +357,11 @@
\end{figure}

\subsection{General eventstudy function}
-This function is wrapper around all the internal functions. This
-function gives an option to compute returns like excess return, market
-residual and augmented market model. It also gives you an option to
-choose inference procedure from bootstrap and wilcoxon to generate
-confidence interval.

+\texttt{eventstudy} is a wrapper around all the internal
+functions. Several examples of the use of this function are provided
+below.
+
<<>>=
es.na <- eventstudy(firm.returns = StockPriceReturns, eventList = SplitDates,