From noreply at r-forge.r-project.org Mon Mar 3 07:44:30 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Mon, 3 Mar 2014 07:44:30 +0100 (CET) Subject: [Eventstudies-commits] r178 - pkg/man Message-ID: <20140303064430.71264185E69@r-forge.r-project.org> Author: chiraganand Date: 2014-03-03 07:44:30 +0100 (Mon, 03 Mar 2014) New Revision: 178 Modified: pkg/man/subperiod.lmAMM.Rd Log: Added classes to arguments, re-formatted the example code and value sections. Some small text modifications. Modified: pkg/man/subperiod.lmAMM.Rd =================================================================== --- pkg/man/subperiod.lmAMM.Rd 2014-02-18 13:21:09 UTC (rev 177) +++ pkg/man/subperiod.lmAMM.Rd 2014-03-03 06:44:30 UTC (rev 178) @@ -1,41 +1,50 @@ \name{subperiod.lmAMM} \alias{subperiod.lmAMM} -\title{A function that estimates exposure for a single firm over multiple periods} +\title{Function to estimate exposure for a single firm over multiple periods} -\description{This function typically utilises an firm.returns vector - and an X matrix of explanatory variables obtained out of - using the makeX function. This would compute the exposure - for all columns in X for the specified time periods. +\description{This function typically utilises a firm.returns vector and + an X matrix of explanatory variables obtained out of the + \sQuote{makeX} function. It computes the exposure for all columns in X + for the specified time periods. } \usage{ -subperiod.lmAMM(firm.returns, X, nlags = 1, verbose = FALSE, dates = NULL, residual = TRUE) +subperiod.lmAMM(firm.returns, + X, + nlags = 1, + verbose = FALSE, + dates = NULL, + residual = TRUE) } \arguments{ - \item{firm.returns}{A vector of data for one firm + \item{firm.returns}{a \sQuote{numeric} vector of data for one firm. } - \item{X}{A matrix of explanatory variables obtained from - the makeX function. The first variable is always the + \item{X}{a matrix of explanatory variables obtained from + the \sQuote{makeX()} function. The first variable is always the stock market index. Other variables could be risk factors such as currency or bond returns, or foreign portfolio inflows. } - \item{nlags}{Number of lags of explanatory variables. When unspecified - the best lag using the AIC is used. + \item{nlags}{\sQuote{integer} of length 1, number of lags of explanatory + variables. When unspecified, the best lag using the AIC is used. } - \item{verbose}{Default is FALSE. When set to TRUE, the function - prints detailed results of using the function. + \item{verbose}{\sQuote{logical}, indicating whether the function + should print detailed results. } - \item{dates}{Default is NULL. If no dates are mentioned, subperiod.lmAMM does - what firmExposures() would do, i.e., estimate exposures for the full time period. + \item{dates}{object of \sQuote{Date} class, specifying the time period + to estimate exposures for. Default is \sQuote{NULL}. If no dates are + mentioned, \sQuote{subperiod.lmAMM} does what \sQuote{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.} + \item{residual}{\sQuote{logical}, returns AMM residuals if TRUE, AMM + exposure otherwise. Defaults to \sQuote{TRUE}.} } -\value{ The function returns the exposures, HAC adjusted standard - errors, the number of lags used, and the residuals from the fitted - model.} +\value{A \sQuote{list} of length 3 is returned: + \item{exposures}{AMM exposure} + \item{sds}{HAC adjusted standard errors} + \item{residuals}{an \sQuote{xts} object of the residuals from the fitted model} +} \author{Vimal Balasubramaniam} @@ -43,20 +52,29 @@ \code{\link{manyfirmsAMM}}} \examples{ -# Create RHS before running subperiod.lmAMM() data("lmAMMData") + +## Create RHS before running subperiod.lmAMM() firm.returns <- lmAMMData$Infosys market.returns <- lmAMMData$index.nifty currency.returns <- lmAMMData$currency.inrusd -regressors <- makeX(market.returns, others=currency.returns, - switch.to.innov=TRUE, market.returns.purge=TRUE, nlags=1, - dates=as.Date(c("2012-02-01","2013-01-01","2014-01-31")), verbose=FALSE) -# Run AMM for one firm across different periods + +regressors <- makeX(market.returns, + others = currency.returns, + switch.to.innov = TRUE, + market.returns.purge = TRUE, + nlags = 1, + dates = as.Date(c("2012-02-01","2013-01-01","2014-01-20")), + verbose = FALSE) + +## Run AMM for one firm across different periods res <- subperiod.lmAMM(firm.returns, - X=regressors, - nlags=1, - verbose=TRUE, - dates= as.Date(c("2012-02-01","2013-01-01","2014-01-31"))) + X = regressors, + nlags = 1, + verbose = FALSE, + dates = as.Date(c("2012-02-01", + "2013-01-01", + "2014-01-20"))) } \keyword{subperiod.lmAMM} \ No newline at end of file From noreply at r-forge.r-project.org Mon Mar 3 08:13:34 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Mon, 3 Mar 2014 08:13:34 +0100 (CET) Subject: [Eventstudies-commits] r179 - pkg/man Message-ID: <20140303071334.762B01846FC@r-forge.r-project.org> Author: chiraganand Date: 2014-03-03 08:13:33 +0100 (Mon, 03 Mar 2014) New Revision: 179 Modified: pkg/man/eventstudy.Rd Log: Added classes to arguments, changed their descriptions. Have added FIXMEs for some arguments, need better description and listing of possible options. Modified: pkg/man/eventstudy.Rd =================================================================== --- pkg/man/eventstudy.Rd 2014-03-03 06:44:30 UTC (rev 178) +++ pkg/man/eventstudy.Rd 2014-03-03 07:13:33 UTC (rev 179) @@ -3,7 +3,7 @@ \title{Event study analysis} -\description{This function computes event study inference using different inference strategies for various market models} +\description{Function to compute event study inference using different inference strategies for various market models.} \usage{ eventstudy(firm.returns = NULL, @@ -19,21 +19,68 @@ } \arguments{ - \item{firm.returns}{Data on which event study is to be performed} - \item{eventList}{A data frame with event dates. It has two columns 'outcome.unit' and 'event.when'. The first column 'outcome.unit' consists of column names of the event stock and 'event.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"} - \item{to.remap}{If TRUE then remap the event frame is done} - \item{remap}{This argument is used when to.remap is TRUE to estimate cumulative sum (cumsum), cumulative product (cumprod) or reindex the event frame} - \item{is.levels}{If the data is in returns format then is.levels is FALSE else TRUE} - \item{inference}{This argument is used to compute confidence interval for the estimator} - \item{inference.strategy}{If inference is TRUE then this argument gives an option to select different inference strategy to compute confidence intervals. Default to bootstrap.} - \item{...}{Accepts specific arguments for the model.} -} + \item{firm.returns}{ + data on which event study is to be performed. + } -\details{If type = "AMM", then the default output is "residual". + \item{eventList}{ + \sQuote{data.frame} of two columns containing event + dates. \dQuote{outcome.unit} consists of column names of the event + stock, and \dQuote{event.when} is the respective event date. } + \item{width}{ % FIXME: needs better description + \sQuote{integer} of length 1, it studies the performance of observations before and + after the event + } + + \item{type}{ + a scalar of type \sQuote{character}, specifying the market + model adjustment. Currently supported options are: + \dQuote{marketResidual}, \dQuote{excessReturn}, \dQuote{AMM} and + \dQuote{None}. Defaults to \dQuote{marketResidual}. See \sQuote{Details}. + } + + \item{to.remap}{ + \sQuote{logical}, indicating if remap of the event frame should be + done. + } + + \item{remap}{ % FIXME: list all the possible + % options properly. Needs better + % explanation of the purpose of + % the argument + \sQuote{character}, this argument is used when \dQuote{to.remap} is + \sQuote{TRUE} to estimate cumulative sum (cumsum), cumulative + product (cumprod) or reindex the event frame. + } + + \item{is.levels}{ + \sQuote{logical}, indicating the format of the data. Set it to + \sQuote{FALSE} if the data is in returns format else \sQuote{TRUE}. + } + + \item{inference}{ + \sQuote{logical}, specifying whether to compute confidence interval + for the estimator. + } + + \item{inference.strategy}{ % FIXME: list all the possible options + a \sQuote{character} scalar specifying the inference strategy to + compute confidence intervals. Is used only if \dQuote{inference} is + \sQuote{TRUE}. Defaults to \dQuote{bootstrap}. + } + + \item{...}{ + further arguments to pass to the model. + } +} + +\details{ + When using \dQuote{AMM} adjustement, the default output is + \dQuote{residual}. +} + \value{ A list with class attribute \sQuote{\code{es}} holding the following elements:\cr From noreply at r-forge.r-project.org Mon Mar 3 08:39:37 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Mon, 3 Mar 2014 08:39:37 +0100 (CET) Subject: [Eventstudies-commits] r180 - pkg/man Message-ID: <20140303073937.E368C181173@r-forge.r-project.org> Author: chiraganand Date: 2014-03-03 08:39:37 +0100 (Mon, 03 Mar 2014) New Revision: 180 Modified: pkg/man/eventstudy.Rd Log: Reformatted value section and the example. Modified: pkg/man/eventstudy.Rd =================================================================== --- pkg/man/eventstudy.Rd 2014-03-03 07:13:33 UTC (rev 179) +++ pkg/man/eventstudy.Rd 2014-03-03 07:39:37 UTC (rev 180) @@ -57,7 +57,7 @@ \item{is.levels}{ \sQuote{logical}, indicating the format of the data. Set it to - \sQuote{FALSE} if the data is in returns format else \sQuote{TRUE}. + \sQuote{FALSE} if the data is in returns format, else \sQuote{TRUE}. } \item{inference}{ @@ -81,28 +81,54 @@ \dQuote{residual}. } -\value{ - A list with class attribute \sQuote{\code{es}} holding the - following elements:\cr +\value{ + A list with class attribute \dQuote{es} holding the + following elements: - \item{eventstudy.output}{Output provides mean/median estimate with confidence interval} - \item{outcomes}{A vector has outcome of each event date. It provides 4 outcomes, 'success', 'wrongspan', 'wdatamissing' and 'unitmissing'. 'success' shows the successful use of event date, 'wdatamissing' appears when width data is missing around the event, if event date falls outside the range of physical date then it returns 'wrongspan' and 'unitmissing' when the unit (firm name) is missing in the event list.} - \item{inference}{Provides information about which inference strategy is utilised to estimate confidence intervals} - \item{width}{Window width for event study output } - \item{remap}{It shows which remapping technique used, for eg. 'cumsum' for cumulative sum, 'cumprod' for cumulative product, 'reindex' for reindexing the series and 'none' for no transformation.} + \item{eventstudy.output}{ + a \sQuote{matrix} containing mean/median estimate with confidence + interval. + } + + \item{outcomes}{ + a \sQuote{character} vector having outcome of each event + date. Provides four outcomes: \cr + \dQuote{success}: shows the successful use of event date. \cr + \dQuote{wdatamissing}: appears when width data is missing around + the event. \cr + \dQuote{wrongspan}: if event date falls outside the range of physical + date. \cr + \dQuote{unimissing}: when the unit (firm name) is missing in the event + list. + } + + \item{inference}{ + a \sQuote{character} providing information about which inference + strategy was utilised to estimate the confidence intervals. + } + + \item{width}{ + a \sQuote{numeric} specifying the window width for event study output. + } + + \item{remap}{ + a \sQuote{character} specifying the remapping technique + used. Options are mentioned in \dQuote{remap} argument description. + } + } \author{Vikram Bahure} \seealso{ \code{\link{lmAMM}}, -\code{\link{marketResidual}}, -\code{\link{excessReturn}}, -\code{\link{phys2eventtime}}, -\code{\link{inference.bootstrap}}, -\code{\link{inference.wilcox}}, -\code{\link{remap.cumsum}}, -\code{\link{remap.cumprod}}, -\code{\link{remap.event.reindex}}, + \code{\link{marketResidual}}, + \code{\link{excessReturn}}, + \code{\link{phys2eventtime}}, + \code{\link{inference.bootstrap}}, + \code{\link{inference.wilcox}}, + \code{\link{remap.cumsum}}, + \code{\link{remap.cumprod}}, + \code{\link{remap.event.reindex}}, } \examples{ @@ -112,8 +138,14 @@ data("SplitDates") ## Event study without adjustment -es <- eventstudy(firm.returns = StockPriceReturns, eventList = SplitDates, width = 10,type = "None", to.remap = TRUE, remap = "cumsum",inference = TRUE, inference.strategy = "bootstrap") - +es <- eventstudy(firm.returns = StockPriceReturns, + eventList = SplitDates, + width = 10, + type = "None", + to.remap = TRUE, + remap = "cumsum", + inference = TRUE, + inference.strategy = "bootstrap") } \keyword{eventstudy} From noreply at r-forge.r-project.org Mon Mar 3 09:17:36 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Mon, 3 Mar 2014 09:17:36 +0100 (CET) Subject: [Eventstudies-commits] r181 - pkg/man Message-ID: <20140303081736.EC819186BA1@r-forge.r-project.org> Author: chiraganand Date: 2014-03-03 09:17:36 +0100 (Mon, 03 Mar 2014) New Revision: 181 Modified: pkg/man/phys2eventtime.Rd Log: Reformatted text, added classes, and FIXMEs. Modified: pkg/man/phys2eventtime.Rd =================================================================== --- pkg/man/phys2eventtime.Rd 2014-03-03 07:39:37 UTC (rev 180) +++ pkg/man/phys2eventtime.Rd 2014-03-03 08:17:36 UTC (rev 181) @@ -2,39 +2,62 @@ \alias{phys2eventtime} \title{ -Converts physical dates to event dates. + Function to convert physical dates to event dates. } -\description{ -Given a zoo time-series and event dates, it converts the physical dates to event dates. The event date becomes zero and all other dates shift accordingly. -} +\description{ Given a zoo time-series and event dates, it converts the + physical dates to event dates. The event date becomes zero and all + other dates shift accordingly. } \usage{ phys2eventtime(z, events, width = 10) } \arguments{ - \item{z}{Time series data for which event frame is to be generated.} + \item{z}{an object of class \pkg{zoo} containing time series data for + which the event frame is to be generated. See \sQuote{Details}.} - \item{events}{It is a data frame with two columns: outcome.unit and event.when. outcome.unit - has column name of which response is to measured on the event date, - while event.when has the event date. See details.} + %% FIXME: should remove this description from eventstudy.Rd, and point + %% it here? + \item{events}{ + \sQuote{data.frame} of two columns containing event + dates. \dQuote{outcome.unit} consists of column names of the event + stock, and \dQuote{event.when} is the respective event date. See + \sQuote{Details}. + } - \item{width}{Width corresponds to the number of days on each side of the event date.For a given width, if there is any NA in the event window then the last observation is carried forward.} + \item{width}{an \sQuote{integer} specifying the number of days on each + side of the event date. For a given width, if there is any \sQuote{NA} + in the event window, then the last observation is carried forward.} } -\details{ If an event date is not found, the function takes the previous - value of date in index(z) as the event date. } +\details{ + The function is used to convert physical dates to event + dates. If an event date is not found, the function takes the previous + value of date in \code{index(z)} as the event date. -\value{Output is in a list format. A zoo object indexed with event time and a vector which describes the status of each unit in the original data. + Currently, this function requires \dQuote{z} to have at least one + \emph{column}. It relies on colnames of the object for the series + names, and match it with the \dQuote{events} object. One can use + \emph{drop = FALSE} with \sQuote{[} to achieve a single-column object. } +\value{ + Returns a \sQuote{list} of: + \item{z.e}{a zoo object indexed with event time.} + %% FIXME: list all the options here instead of writing them inside + %% eventstudy.Rd? + \item{outcomes}{a \sQuote{character} vector containing the + status of each \dQuote{outcome.unit}. + } + + \examples{ data(StockPriceReturns) data(SplitDates) -phys2eventtime(z=StockPriceReturns, events=SplitDates,width=5) +phys2eventtime(z = StockPriceReturns, events = SplitDates,width = 5) } \keyword{ phys2eventime } From noreply at r-forge.r-project.org Mon Mar 3 09:18:58 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Mon, 3 Mar 2014 09:18:58 +0100 (CET) Subject: [Eventstudies-commits] r182 - pkg/man Message-ID: <20140303081858.DB0C2186BD8@r-forge.r-project.org> Author: chiraganand Date: 2014-03-03 09:18:58 +0100 (Mon, 03 Mar 2014) New Revision: 182 Modified: pkg/man/phys2eventtime.Rd Log: Added missing brace. Modified: pkg/man/phys2eventtime.Rd =================================================================== --- pkg/man/phys2eventtime.Rd 2014-03-03 08:17:36 UTC (rev 181) +++ pkg/man/phys2eventtime.Rd 2014-03-03 08:18:58 UTC (rev 182) @@ -52,8 +52,8 @@ \item{outcomes}{a \sQuote{character} vector containing the status of each \dQuote{outcome.unit}. } +} - \examples{ data(StockPriceReturns) data(SplitDates) From noreply at r-forge.r-project.org Mon Mar 3 10:17:07 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Mon, 3 Mar 2014 10:17:07 +0100 (CET) Subject: [Eventstudies-commits] r183 - pkg/man Message-ID: <20140303091707.7C2B9186BFF@r-forge.r-project.org> Author: chiraganand Date: 2014-03-03 10:17:07 +0100 (Mon, 03 Mar 2014) New Revision: 183 Modified: pkg/man/phys2eventtime.Rd Log: Some language changes. Modified: pkg/man/phys2eventtime.Rd =================================================================== --- pkg/man/phys2eventtime.Rd 2014-03-03 08:18:58 UTC (rev 182) +++ pkg/man/phys2eventtime.Rd 2014-03-03 09:17:07 UTC (rev 183) @@ -39,12 +39,12 @@ Currently, this function requires \dQuote{z} to have at least one \emph{column}. It relies on colnames of the object for the series - names, and match it with the \dQuote{events} object. One can use - \emph{drop = FALSE} with \sQuote{[} to achieve a single-column object. + names, and matches it with the \dQuote{events} object. One can use + \code{drop = FALSE} with \sQuote{[} to achieve a single-column object. } \value{ - Returns a \sQuote{list} of: + Returns a \sQuote{list} of two elements: \item{z.e}{a zoo object indexed with event time.} %% FIXME: list all the options here instead of writing them inside From noreply at r-forge.r-project.org Mon Mar 3 10:39:26 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Mon, 3 Mar 2014 10:39:26 +0100 (CET) Subject: [Eventstudies-commits] r184 - pkg/man Message-ID: <20140303093926.4DC961801C7@r-forge.r-project.org> Author: chiraganand Date: 2014-03-03 10:39:26 +0100 (Mon, 03 Mar 2014) New Revision: 184 Modified: pkg/man/inference.bootstrap.Rd Log: Modified formatting and language. Modified: pkg/man/inference.bootstrap.Rd =================================================================== --- pkg/man/inference.bootstrap.Rd 2014-03-03 09:17:07 UTC (rev 183) +++ pkg/man/inference.bootstrap.Rd 2014-03-03 09:39:26 UTC (rev 184) @@ -1,41 +1,66 @@ \name{inference.bootstrap} \alias{inference.bootstrap} -\title{ -Bootstrap inference for the event study. -} +\title{Function to do bootstrap inference for the event study.} \description{ -This function does bootstrap inference to generate distribution of average of all the cumulative returns time-series. - } + This function does bootstrap inference to generate distribution of + average of all the cumulative returns time-series. +} \usage{ -inference.bootstrap(es.w, to.plot = TRUE, xlab = "Event time", - ylab = "Cumulative returns of response series", - main = "Event study plot") +inference.bootstrap(es.w, + to.plot = TRUE, + xlab = "Event time", + ylab = "Cumulative returns of response series", + main = "Event study plot") } \arguments{ - \item{es.w}{es.w is the first component of the list returned by the function phys2eventtime.} - \item{to.plot}{This argument will generate an eventstudy plot of the inference estimated. If to.plot is equal to TRUE then function would generate the plot else it would not. } - \item{xlab}{If to.plot is TRUE then the plot generated will take this X label} - \item{ylab}{If to.plot is TRUE then the plot generated will take this Y label} - \item{main}{If to.plot is TRUE then the plot generated will take this as main title} + \item{es.w}{ + a \pkg{zoo} series indexed by event time: the \dQuote{z.e} + component of the list returned by the \sQuote{phys2eventtime()} + function. + } + + \item{to.plot}{a \sQuote{logical} indicating whether to generate an + eventstudy plot of the inference estimated. Defaults to + \sQuote{TRUE}. + } + + \item{xlab}{the x-axis label of the generated plot. Used if + \dQuote{to.plot} is \sQuote{TRUE}.} + + \item{ylab}{the y-axis label of the generated plot. Used if + \dQuote{to.plot} is \sQuote{TRUE}.} + + \item{main}{main title of the plot. Used if \dQuote{to.plot} is + \sQuote{TRUE}.} } \value{ -A data frame with 3 columns, the lower confidence interval (CI), the mean and the upper CI which are the result of bootstrap inference. + A \sQuote{matrix} with 3 columns, the lower confidence interval + (CI), the mean, and the upper CI which are the result of bootstrap + inference. } \seealso{ -phys2eventtime + phys2eventtime } \examples{ data(StockPriceReturns) data(SplitDates) -es.results <- phys2eventtime(z=StockPriceReturns, events=SplitDates,width=5) -es.w <- window(es.results$z.e, start=-5, end=+5) -eventtime <- remap.cumsum(es.w, is.pc=FALSE, base=0) -inference.bootstrap(es.w=eventtime, to.plot=FALSE) -} \ No newline at end of file + +es.results <- phys2eventtime(z = StockPriceReturns, + events = SplitDates, + width = 5) +es.w <- window(es.results$z.e, + start = -5, + end = +5) + +eventtime <- remap.cumsum(es.w, is.pc = FALSE, base = 0) + +inference.bootstrap(es.w = eventtime, + to.plot = FALSE) +} From noreply at r-forge.r-project.org Sat Mar 8 18:47:51 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 8 Mar 2014 18:47:51 +0100 (CET) Subject: [Eventstudies-commits] r185 - pkg/R Message-ID: <20140308174751.C5598186850@r-forge.r-project.org> Author: vikram Date: 2014-03-08 18:47:51 +0100 (Sat, 08 Mar 2014) New Revision: 185 Modified: pkg/R/remap.cumprod.R pkg/R/remap.cumsum.R Log: Fixed the remap function to have first value as zero and start cumulative abnormal returns from there Modified: pkg/R/remap.cumprod.R =================================================================== --- pkg/R/remap.cumprod.R 2014-03-03 09:39:26 UTC (rev 184) +++ pkg/R/remap.cumprod.R 2014-03-08 17:47:51 UTC (rev 185) @@ -6,6 +6,7 @@ # is.returns is false in this case is.pc is ignored! # values are like 1.01 for 1% remap.cumprod <- function(z, is.pc=TRUE, is.returns=TRUE, base=100) { + z <- firstValueZero(z) for (i in 1:NCOL(z)) { tmp <- z[,i] if (is.returns) { @@ -23,3 +24,12 @@ } z } + +firstValueZero <- function(x){ + if(NCOL(x)==1){ + x[1] <- 0 + } else { + x[1,] <- 0 + } + return(x) +} Modified: pkg/R/remap.cumsum.R =================================================================== --- pkg/R/remap.cumsum.R 2014-03-03 09:39:26 UTC (rev 184) +++ pkg/R/remap.cumsum.R 2014-03-08 17:47:51 UTC (rev 185) @@ -1,6 +1,7 @@ # If is.pc then a value like "1" means 0.01 remap.cumsum <- function(z, is.pc=TRUE, base=0) { + z <- firstValueZero(z) for (i in 1:NCOL(z)) { tmp <- z[,i] if (is.pc) { @@ -14,3 +15,12 @@ } z } + +firstValueZero <- function(x){ + if(NCOL(x)==1){ + x[1] <- 0 + } else { + x[1,] <- 0 + } + return(x) +} From noreply at r-forge.r-project.org Sun Mar 16 11:23:18 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 16 Mar 2014 11:23:18 +0100 (CET) Subject: [Eventstudies-commits] r186 - in pkg: R man Message-ID: <20140316102318.C3587186E36@r-forge.r-project.org> Author: chiraganand Date: 2014-03-16 11:23:18 +0100 (Sun, 16 Mar 2014) New Revision: 186 Modified: pkg/R/excessReturn.R pkg/man/excessReturn.Rd Log: Added object classes, modified description, added FIXME to the code. Modified: pkg/R/excessReturn.R =================================================================== --- pkg/R/excessReturn.R 2014-03-08 17:47:51 UTC (rev 185) +++ pkg/R/excessReturn.R 2014-03-16 10:23:18 UTC (rev 186) @@ -2,6 +2,7 @@ # Excess return ############### # Argument: +## FIXME: data.object?? # 1. data.object: This is a time series object with firm return and market return # 2. market.name: It is the market (index) column name in the data object # Output: @@ -9,6 +10,6 @@ excessReturn <- function(firm.returns, market.returns){ ## Getting market return - ma.ret <- firm.returns-market.returns + ma.ret <- firm.returns - market.returns return(ma.ret) } Modified: pkg/man/excessReturn.Rd =================================================================== --- pkg/man/excessReturn.Rd 2014-03-08 17:47:51 UTC (rev 185) +++ pkg/man/excessReturn.Rd 2014-03-16 10:23:18 UTC (rev 186) @@ -3,15 +3,18 @@ \title{A function that estimates excess return} -\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. -} +\description{ This function estimates excess returns. If the firm return + is \dQuote{firm.returns} and market return is \dQuote{market.returns}, + then output will be \dQuote{firm.returns} less + \dQuote{market.returns}. } \usage{excessReturn(firm.returns, market.returns)} \arguments{ - \item{firm.returns}{Firm returns of which excess return from market is to be calculated} - \item{market.returns}{Market index returns} - + \item{firm.returns}{a \pkg{zoo} timeseries with firm returns from + which excess returns from market are to be calculated.} + \item{market.returns}{a \pkg{zoo} object containing market index + returns.} } \value{Excess market return} @@ -22,7 +25,6 @@ data(nifty.index) er.result <- excessReturn(firm.returns = StockPriceReturns, market.returns = nifty.index) - } -\keyword{excessReturn} \ No newline at end of file +\keyword{excessReturn} From noreply at r-forge.r-project.org Sun Mar 16 11:24:30 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 16 Mar 2014 11:24:30 +0100 (CET) Subject: [Eventstudies-commits] r187 - pkg/man Message-ID: <20140316102430.14F4E186E80@r-forge.r-project.org> Author: chiraganand Date: 2014-03-16 11:24:29 +0100 (Sun, 16 Mar 2014) New Revision: 187 Modified: pkg/man/eventstudy-package.Rd Log: Little modification in the text. Modified: pkg/man/eventstudy-package.Rd =================================================================== --- pkg/man/eventstudy-package.Rd 2014-03-16 10:23:18 UTC (rev 186) +++ pkg/man/eventstudy-package.Rd 2014-03-16 10:24:29 UTC (rev 187) @@ -7,7 +7,7 @@ } \description{ -This package is used to undertake event study analysis using R. +This package is used for performing event study analysis in R. } \details{ From noreply at r-forge.r-project.org Sun Mar 16 12:14:18 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 16 Mar 2014 12:14:18 +0100 (CET) Subject: [Eventstudies-commits] r188 - pkg/man Message-ID: <20140316111418.3F7BA1869E0@r-forge.r-project.org> Author: chiraganand Date: 2014-03-16 12:14:17 +0100 (Sun, 16 Mar 2014) New Revision: 188 Modified: pkg/man/lmAMM.Rd Log: Added classes to arguments, modified some text. Modified: pkg/man/lmAMM.Rd =================================================================== --- pkg/man/lmAMM.Rd 2014-03-16 10:24:29 UTC (rev 187) +++ pkg/man/lmAMM.Rd 2014-03-16 11:14:17 UTC (rev 188) @@ -3,47 +3,49 @@ \title{Augmented market model (AMM) estimation} -\description{This function relates firm returns to the regressors using the linear model (market index movements, currency fluctuations etc.). -It computes firm exposure for all the regressors in columns of X and subsequently estimates AMM residuals by purging out variation -from regressand. -} +\description{This function relates firm returns to the regressors using + the linear model (market index movements, currency fluctuations etc.). + It computes firm exposure for all the regressors in columns of X and + subsequently estimates AMM residuals by purging out variation from + the regressand.} \usage{ lmAMM(firm.returns, X, nlags = NA, verbose = FALSE) } \arguments{ - \item{firm.returns}{A time series object of firm returns for AMM estimation} - \item{X}{A time series of explanatory variables obtained from - the makeX function. The first variable is always the - stock market index. Other variables could be - such as currency or bond returns, or other variables as - desired by the user. - } + \item{firm.returns}{a \pkg{zoo} time series object of firm returns for + AMM estimation.} - \item{nlags}{Number of lags of explanatory variables. When unspecified - the best lag using the AIC is used. - } + \item{X}{a time series of explanatory variables obtained from the + makeX function. The first variable is always the stock market + index. Other variables could be such as currency or bond returns, or + other variables as desired by the user.} - \item{verbose}{Default is FALSE. When set to TRUE, the function - prints detailed results while running this function. - } -} + \item{nlags}{an \sQuote{integer} with the number of lags of + explanatory variables. When unspecified, the best lag using the AIC + is used.} + \item{verbose}{a \sQuote{logical}. Print function details. When set to + \sQuote{TRUE}, the function prints detailed results while + running. Default is \sQuote{FALSE}.} } -\value{ The function returns the exposures, HAC adjusted standard - errors, the number of lags used, and the residuals from the fitted - model. -\item{exposures}{This contains the exposure estimates for the firm -j} +\value{The function returns a \sQuote{list} containing exposures, HAC + adjusted standard errors, number of lags used, and residuals from the + fitted model. -\item{s.exposures}{This contains the HAC adjusted standard error -of the exposures estimated for the firm firm.returns.} + \item{exposures}{a \sQuote{numeric} containing exposure estimates for + the firm j.} -\item{nlags}{Specifies the lag length provided by the user} + %% FIXME: "for the firm firm.returns" doesn't make sense. Is it "for + %% the firm with returns 'firm.returns'? + \item{s.exposures}{a \sQuote{numeric} containing the HAC adjusted + standard error of the exposures estimated for the firm + firm.returns.} + \item{nlags}{shows the lag length provided by user.} } \author{Ajay Shah, Vimal Balasubramaniam} From noreply at r-forge.r-project.org Sun Mar 16 12:18:00 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 16 Mar 2014 12:18:00 +0100 (CET) Subject: [Eventstudies-commits] r189 - pkg/man Message-ID: <20140316111800.A407E186B73@r-forge.r-project.org> Author: chiraganand Date: 2014-03-16 12:18:00 +0100 (Sun, 16 Mar 2014) New Revision: 189 Modified: pkg/man/SplitDates.Rd Log: Changed formatting Modified: pkg/man/SplitDates.Rd =================================================================== --- pkg/man/SplitDates.Rd 2014-03-16 11:14:17 UTC (rev 188) +++ pkg/man/SplitDates.Rd 2014-03-16 11:18:00 UTC (rev 189) @@ -6,8 +6,11 @@ \title{A set of events to perform eventstudy analysis.} -\description{ -The data contains stock split event dates for the index constituents of the Bombay Stock Exchange index (SENSEX). The data format follows the required format in the function \code{phys2eventtime}, with two columns 'outcome.unit' (firm name) and 'event.when' (stock split date).} +\description{ This data set contains stock split event dates for the index + constituents of the Bombay Stock Exchange index (SENSEX). The data + format follows the required format in the function + \code{phys2eventtime}, with two columns 'outcome.unit' (firm name) and + 'event.when' (stock split date).} \usage{data(SplitDates)} @@ -16,4 +19,4 @@ \examples{ data(SplitDates) } -\keyword{dataset} +\keyword{datasets} From noreply at r-forge.r-project.org Sun Mar 16 12:42:20 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 16 Mar 2014 12:42:20 +0100 (CET) Subject: [Eventstudies-commits] r190 - pkg/man Message-ID: <20140316114220.949CA1859D3@r-forge.r-project.org> Author: chiraganand Date: 2014-03-16 12:42:20 +0100 (Sun, 16 Mar 2014) New Revision: 190 Modified: pkg/man/ees.Rd Log: Text/formatting changes. Modified: pkg/man/ees.Rd =================================================================== --- pkg/man/ees.Rd 2014-03-16 11:18:00 UTC (rev 189) +++ pkg/man/ees.Rd 2014-03-16 11:42:20 UTC (rev 190) @@ -5,32 +5,47 @@ Extreme events study analysis for a univariate time series } -\description{ -This function identifies tail events on a univariate time series, generates summary statistics for clustered and unclustered tail events.} +\description{This function identifies tail events on a univariate time + series, generates summary statistics for clustered and unclustered + tail events.} \usage{ -ees(input,prob.value) +ees(input, prob.value) } \arguments{ - \item{input}{A univariate time series for which tail events identification is required.} - \item{prob.value}{The cut off (in percent) on the probability distribution for the tail event.} + + \item{input}{a univariate \pkg{zoo} time series for which tail events + identification is required.} + + \item{prob.value}{The cut off (in percent) on the probability + distribution for the tail event.} } -\value{ A \code{list} object that contains: - \item{Summary statistics}{Summary of the data set} - \item{Lower tail}{Distribution of extreme events; Run length - distribution; Quantile values; Yearly distribution; and the tail events data} - \item{Upper tail}{Distribution of extreme events; Run length - distribution; Quantile values; Yearly distribution; and the tail events data} +\value{ A \code{list} object containing: + + \item{data.summary}{a \sQuote{data.frame} containing summary of + the data set.} + + \item{lower.tail}{a \sQuote{list} containing: distribution of extreme + events, run length distribution, quantile values, yearly + distribution, and the tail events data.} + + \item{upper.tail}{a \sQuote{list} containing: distribution of extreme + events, run length distribution, quantile values, yearly + distribution, and the tail events data.} } -\references{To convert number to words, code uses function \href{http://finzi.psych.upenn.edu/R/Rhelp02a/archive/46843.html}{numbers2words} by \href{http://socserv.mcmaster.ca/jfox/}{John Fox} and deprintize function by \href{http://mbq.me/}{Miron Kursa} } +\references{To convert number to words, code uses function + \href{http://finzi.psych.upenn.edu/R/Rhelp02a/archive/46843.html}{\dQuote{numbers2words}} + by \href{http://socserv.mcmaster.ca/jfox/}{John Fox} and + \dQuote{deprintize} function by \href{http://mbq.me/}{Miron Kursa}. +} \author{Vikram Bahure} \examples{ library(eventstudies) data(eesData) input <- eesData$sp500 -output <- ees(input, prob.value=5) +output <- ees(input, prob.value = 5) } From noreply at r-forge.r-project.org Sun Mar 16 13:03:23 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 16 Mar 2014 13:03:23 +0100 (CET) Subject: [Eventstudies-commits] r191 - pkg/man Message-ID: <20140316120323.C5221186FB7@r-forge.r-project.org> Author: chiraganand Date: 2014-03-16 13:03:23 +0100 (Sun, 16 Mar 2014) New Revision: 191 Modified: pkg/man/eesPlot.Rd Log: Fixed formatting, added fixme for the example: doesn't work. Modified: pkg/man/eesPlot.Rd =================================================================== --- pkg/man/eesPlot.Rd 2014-03-16 11:42:20 UTC (rev 190) +++ pkg/man/eesPlot.Rd 2014-03-16 12:03:23 UTC (rev 191) @@ -5,29 +5,53 @@ Plotting clustered and unclustered extreme events retuns. } -\description{ -This function replicates result of Patnaik, Shah and Singh (2013). The function creates an event study plot that treats all clustered events as one event. It plots both the lower and upper tail events and the events are defined based on the cut off probability values provided (in percentage terms).} +\description{The function creates an event study plot that treats all + clustered events as one event. It plots both the lower and upper tail + events and the events are defined based on the cut off probability + values provided (in percentage terms).This function replicates result + of Patnaik, Shah, and Singh (2013).} - \usage{ -eesPlot(z, response.series.name, event.series.name, titlestring, ylab, width, prob.value) +eesPlot(z, + response.series.name, + event.series.name, + titlestring, + ylab, + width, + prob.value) } \arguments{ - \item{z}{Data object with both response and event series on which event study is to be performed} - \item{response.series.name}{Column name of the series in 'z' on which response is to be observed } - \item{event.series.name}{Column name of the series in 'z' on which event is to be defined } - \item{titlestring}{Title for event study plot} - \item{ylab}{Y-axis label} - \item{width}{Width for event study plot} - \item{prob.value}{Cut-off values in the probability distribution (in percentage terms)} + + \item{z}{Data object with both response and event series on which + event study is to be performed.} + + \item{response.series.name}{Column name of the series in \sQuote{z} on which + response is to be observed.} + + \item{event.series.name}{Column name of the series in \sQuote{z} on which + event is to be defined.} + + \item{titlestring}{Title for event study plot.} + + \item{ylab}{Y-axis label of the plot.} + + \item{width}{Width for event study plot.} + + \item{prob.value}{Cut-off values in the probability distribution (in + percentage terms).} } -\value{ -A plot of the response series with lower and upper tail events defined on the event series.} +\value{A plot of the response series with lower and upper tail events + defined on the event series.} +%% FIXME: example doesn't work! \examples{ library(eventstudies) data(eesData) -eesPlot(z=eesData, response.series.name="nifty", event.series.name="sp500",titlestring="S&P500", ylab="(Cum.) change in NIFTY") -} \ No newline at end of file +eesPlot(z = eesData, + response.series.name = "nifty", + event.series.name = "sp500", + titlestring = "S&P500", + ylab = "(Cum.) change in NIFTY") +} From noreply at r-forge.r-project.org Sun Mar 16 13:05:02 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 16 Mar 2014 13:05:02 +0100 (CET) Subject: [Eventstudies-commits] r192 - pkg/man Message-ID: <20140316120502.493DD1812A9@r-forge.r-project.org> Author: chiraganand Date: 2014-03-16 13:05:01 +0100 (Sun, 16 Mar 2014) New Revision: 192 Modified: pkg/man/inference.bootstrap.Rd Log: Fixed language. Modified: pkg/man/inference.bootstrap.Rd =================================================================== --- pkg/man/inference.bootstrap.Rd 2014-03-16 12:03:23 UTC (rev 191) +++ pkg/man/inference.bootstrap.Rd 2014-03-16 12:05:01 UTC (rev 192) @@ -1,7 +1,7 @@ \name{inference.bootstrap} \alias{inference.bootstrap} -\title{Function to do bootstrap inference for the event study.} +\title{Function to do bootstrap inference for event study analysis.} \description{ This function does bootstrap inference to generate distribution of From noreply at r-forge.r-project.org Sun Mar 16 13:21:23 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 16 Mar 2014 13:21:23 +0100 (CET) Subject: [Eventstudies-commits] r193 - pkg/man Message-ID: <20140316122123.92707186E31@r-forge.r-project.org> Author: chiraganand Date: 2014-03-16 13:21:22 +0100 (Sun, 16 Mar 2014) New Revision: 193 Modified: pkg/man/inference.wilcox.Rd Log: Fixed text formatting. Modified: pkg/man/inference.wilcox.Rd =================================================================== --- pkg/man/inference.wilcox.Rd 2014-03-16 12:05:01 UTC (rev 192) +++ pkg/man/inference.wilcox.Rd 2014-03-16 12:21:22 UTC (rev 193) @@ -2,7 +2,7 @@ \alias{inference.wilcox} \title{ -Wilcox inference for the event study. + Wilcox inference for the event study. } \description{ @@ -10,34 +10,48 @@ } \usage{ -inference.wilcox(es.w,to.plot = TRUE, xlab = "Event time", - ylab = "Cumulative returns of response series", - main = "Event study plot") +inference.wilcox(es.w, + to.plot = TRUE, + xlab = "Event time", + ylab = "Cumulative returns of response series", + main = "Event study plot") } \arguments{ - \item{es.w}{es.w is the first component of the list returned by the function phys2eventtime.} - \item{to.plot}{This argument will generate an eventstudy plot of the inference estimated. If to.plot is equal to TRUE then function would generate the plot else it would not. } - \item{xlab}{If to.plot is TRUE then the plot generated will take this X label} - \item{ylab}{If to.plot is TRUE then the plot generated will take this Y label} - \item{main}{If to.plot is TRUE then the plot generated will take this as main title} -} + + \item{es.w}{a \pkg{zoo} series indexed by event time. It is the + \dQuote{z.e} component of the list returned by function + \dQuote{phys2eventtime}.} -\value{ -A data frame with 3 columns, the lower confidence interval (CI), the mean and the upper CI which are the result of wilcox inference. + \item{to.plot}{a \sQuote{logical}. Whether to generate an eventstudy plot of the + inference estimated. Default is \sQuote{TRUE}.} + + \item{xlab}{If to.plot is \sQuote{TRUE}, then the plot generated will take this X label.} + + \item{ylab}{If to.plot is \sQuote{TRUE}, then the plot generated will + take this Y label.} + + \item{main}{If to.plot is \sQuote{TRUE}, then the plot generated will + take this as the main title.} } +\value{A \sQuote{matrix} with 3 columns: the lower confidence interval (CI), + the mean, and the upper CI which are the result of wilcox inference.} + \author{Vikram Bahure} \seealso{ -phys2eventtime + phys2eventtime } \examples{ data(StockPriceReturns) data(SplitDates) -es.results <- phys2eventtime(z=StockPriceReturns, events=SplitDates,width=5) -es.w <- window(es.results$z.e, start=-5, end=+5) -eventtime <- remap.cumsum(es.w, is.pc=FALSE, base=0) -inference.wilcox(es.w=eventtime, to.plot=FALSE) -} \ No newline at end of file +es.results <- phys2eventtime(z = StockPriceReturns, + events = SplitDates, + width = 5) +es.w <- window(es.results$z.e, start = -5, end = +5) +eventtime <- remap.cumsum(es.w, is.pc = FALSE, base = 0) +infr <- inference.wilcox(es.w = eventtime, to.plot = FALSE) +head(infr) +} From noreply at r-forge.r-project.org Sun Mar 16 13:23:58 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 16 Mar 2014 13:23:58 +0100 (CET) Subject: [Eventstudies-commits] r194 - pkg/man Message-ID: <20140316122358.E9420186E9D@r-forge.r-project.org> Author: chiraganand Date: 2014-03-16 13:23:58 +0100 (Sun, 16 Mar 2014) New Revision: 194 Modified: pkg/man/inr.Rd Log: Fixed formatting. Modified: pkg/man/inr.Rd =================================================================== --- pkg/man/inr.Rd 2014-03-16 12:21:22 UTC (rev 193) +++ pkg/man/inr.Rd 2014-03-16 12:23:58 UTC (rev 194) @@ -1,16 +1,20 @@ \name{inr} \alias{inr} \docType{data} + \title{ -Exchange rate for Indian rupee: INR/USD + Exchange rate for Indian rupee: INR/USD } + \description{ -A sample of INR/USD rates from 1990 to 2011. It is stored as an xts object. + A sample of INR/USD rates from 1990 to 2011. } \usage{data(inr)} -\format{ It is an xts object containing daily data from 1990 to 2011. The format is: chr 'inr.rda' -} + +\format{\pkg{zoo}} + \examples{ data(inr) } + \keyword{datasets} From noreply at r-forge.r-project.org Sun Mar 16 13:25:42 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 16 Mar 2014 13:25:42 +0100 (CET) Subject: [Eventstudies-commits] r195 - pkg/man Message-ID: <20140316122542.95693186EE6@r-forge.r-project.org> Author: chiraganand Date: 2014-03-16 13:25:42 +0100 (Sun, 16 Mar 2014) New Revision: 195 Modified: pkg/man/lmAMM.Rd Log: Fixed formatting of the example. Modified: pkg/man/lmAMM.Rd =================================================================== --- pkg/man/lmAMM.Rd 2014-03-16 12:23:58 UTC (rev 194) +++ pkg/man/lmAMM.Rd 2014-03-16 12:25:42 UTC (rev 195) @@ -57,14 +57,20 @@ \examples{ # lmAMM data("lmAMMData") + firm.returns <- lmAMMData[,"Infosys"] market.returns <- lmAMMData[,"index.nifty"] currency.returns <- lmAMMData[,"currency.inrusd"] + ## Creating regressors for AMM estimation using makeX function -X <- makeX(market.returns, others=currency.returns, - switch.to.innov=FALSE, market.returns.purge=FALSE, verbose=FALSE) -a <- lmAMM(firm.returns, X, nlags=0, verbose=FALSE) +X <- makeX(market.returns, + others = currency.returns, + switch.to.innov = FALSE, + market.returns.purge = FALSE, + verbose = FALSE) + +a <- lmAMM(firm.returns, X, nlags = 0, verbose = FALSE) print(a) } -\keyword{lmAMM} \ No newline at end of file +\keyword{lmAMM} From noreply at r-forge.r-project.org Sun Mar 16 13:44:26 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 16 Mar 2014 13:44:26 +0100 (CET) Subject: [Eventstudies-commits] r196 - pkg/man Message-ID: <20140316124426.91C75186750@r-forge.r-project.org> Author: chiraganand Date: 2014-03-16 13:44:25 +0100 (Sun, 16 Mar 2014) New Revision: 196 Modified: pkg/man/makeX.Rd Log: Formatting/text changes. Modified: pkg/man/makeX.Rd =================================================================== --- pkg/man/makeX.Rd 2014-03-16 12:25:42 UTC (rev 195) +++ pkg/man/makeX.Rd 2014-03-16 12:44:25 UTC (rev 196) @@ -1,73 +1,79 @@ \name{makeX} \alias{makeX} -\title{A function to prepare explanatory variables for computation -of Augmented Market Models used in lmAMM function -} -\description{ - This function creates a matrix of explanatory variables in the - form specified by the user for further estimation of Augmented - market models -} +\title{A function to prepare explanatory variables for computation of + Augmented Market Models used in lmAMM function.} +\description{This function creates a matrix of explanatory variables in + the form specified by the user for further estimation of Augmented + market models.} + \usage{ -makeX(market.returns, others, switch.to.innov = rep(TRUE, NCOL(others)), market.returns.purge = TRUE, nlags = 5, dates = NULL, verbose = FALSE) +makeX(market.returns, + others, + switch.to.innov = rep(TRUE, NCOL(others)), + market.returns.purge = TRUE, + nlags = 5, + dates = NULL, + verbose = FALSE) } \arguments{ - \item{market.returns}{This is generally fixed to the stock market index. The - first column vector of this matrix contains this variable. -} + %% FIXME: our example contains univariate time-series object. Can it + %% accept multiple columns as input? + \item{market.returns}{a \pkg{zoo} timeseries object. This is generally + fixed to the stock market index. The first column vector of this + matrix contains this variable. } + %% FIXME: same as market.returns: can it contain more than one variable? \item{others}{A zoo matrix with other regressors of interest in the - AMM - this could be currency, bond returns, foreign flows or any - other variable. -} + AMM. This could be currency, bond returns, foreign flows, or any + other variable.} - \item{switch.to.innov}{is a vector of booleans with one element for - each column in 'others'. This controls whether or not that column in - 'others' is switched from raw values to AR residuals. -} + \item{switch.to.innov}{a \sQuote{logical} vector with an element for + each column in \dQuote{others}. Whether to switch the column from + raw values to AR residuals.} - \item{market.returns.purge}{whether or not the effects of all these 'others' are - purged from 'market.returns' (i.e., is it replaced by residuals of a model - explaining market.returns using all these 'others'). -} + %% FIXME: Second part of the sentence (i.e.) is somewhat unclear. + \item{market.returns.purge}{Whether to purge the effects + \dQuote{others} from \dQuote{market.returns} (i.e., is it replaced by + residuals of a model explaining market.returns using all these + 'others').} - \item{nlags}{The number of lag terms present in this model explaining - market.returns using all these 'others'. -} + \item{nlags}{The number of lag terms present in this model explaining + market.returns using all these \dQuote{others}.} - \item{dates}{Specified break dates (either from structural breaks in - exchange rate regimes) so that all these steps are constructed within - each sub-period divided by the dates. -} + \item{dates}{Specified break dates as \sQuote{Date} object (either from + structural breaks in exchange rate regimes) so that all these steps + are constructed within each sub-period divided by the dates.} - \item{verbose}{Whether detailed print while running this function - is required. + \item{verbose}{Whether detailed output is required. Default is + \sQuote{FALSE}}. } +%% FIXME: Provide a reason why there shouldn't be NAs. +\section{Warning}{The input data should not contain \sQuote{NA}s. Please + use \sQuote{na.omit} before feeding data into this function.} } -\section{Warning}{The input data has to be all na.omit(). There - should be no NAs in the dataset fed into this function. -} - \value{This function generates a user specified matrix of explanatory variables that will be further used in running Augmented market - models. -} + models.} \author{Ajay Shah, Vimal Balasubramaniam} \examples{ -# makeX data("lmAMMData") + market.returns <- lmAMMData$index.nifty currency.returns <- lmAMMData$currency.inrusd -X <- makeX(market.returns, others=currency.returns, - switch.to.innov=FALSE, market.returns.purge=FALSE, verbose=FALSE) + +X <- makeX(market.returns, + others = currency.returns, + switch.to.innov = FALSE, + market.returns.purge = FALSE, + verbose = FALSE) } \keyword{makeX} From noreply at r-forge.r-project.org Sun Mar 16 13:49:03 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 16 Mar 2014 13:49:03 +0100 (CET) Subject: [Eventstudies-commits] r197 - pkg/man Message-ID: <20140316124903.BBA9A186954@r-forge.r-project.org> Author: chiraganand Date: 2014-03-16 13:49:03 +0100 (Sun, 16 Mar 2014) New Revision: 197 Modified: pkg/man/makeX.Rd Log: Removed extra brace. Modified: pkg/man/makeX.Rd =================================================================== --- pkg/man/makeX.Rd 2014-03-16 12:44:25 UTC (rev 196) +++ pkg/man/makeX.Rd 2014-03-16 12:49:03 UTC (rev 197) @@ -54,7 +54,6 @@ %% FIXME: Provide a reason why there shouldn't be NAs. \section{Warning}{The input data should not contain \sQuote{NA}s. Please use \sQuote{na.omit} before feeding data into this function.} -} \value{This function generates a user specified matrix of explanatory variables that will be further used in running Augmented market From noreply at r-forge.r-project.org Sun Mar 16 13:56:06 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 16 Mar 2014 13:56:06 +0100 (CET) Subject: [Eventstudies-commits] r198 - pkg/man Message-ID: <20140316125606.57D90186C24@r-forge.r-project.org> Author: chiraganand Date: 2014-03-16 13:56:06 +0100 (Sun, 16 Mar 2014) New Revision: 198 Modified: pkg/man/StockPriceReturns.Rd Log: Modified description as the data set has changed. Added fixme: whether to remove NAs from the data set. Modified: pkg/man/StockPriceReturns.Rd =================================================================== --- pkg/man/StockPriceReturns.Rd 2014-03-16 12:49:03 UTC (rev 197) +++ pkg/man/StockPriceReturns.Rd 2014-03-16 12:56:06 UTC (rev 198) @@ -6,9 +6,11 @@ \title{An example dataset of stock price returns to perform eventstudy analysis.} -\description{Daily stock price returns for the index constituents of the Bombay Stock Exchange Index (SENSEX) and the National Stock Exchange of India Index (NIFTY), NIFTY index, and the Rupee-Dollar exchange rate returns.} +% FIXME: Remove NAs in the dataset? +\description{This data set contains stock price returns of 30 major + stocks on the National Stock Exchange (NSE) of India for a period of 23 + years.} - \usage{data(StockPriceReturns)} \format{\code{zoo}} From noreply at r-forge.r-project.org Sun Mar 16 14:31:01 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 16 Mar 2014 14:31:01 +0100 (CET) Subject: [Eventstudies-commits] r199 - / Message-ID: <20140316133101.E1A32186F01@r-forge.r-project.org> Author: chiraganand Date: 2014-03-16 14:31:01 +0100 (Sun, 16 Mar 2014) New Revision: 199 Modified: todo.org Log: Added todo on changing description and test cases. Modified: todo.org =================================================================== --- todo.org 2014-03-16 12:56:06 UTC (rev 198) +++ todo.org 2014-03-16 13:31:01 UTC (rev 199) @@ -4,7 +4,13 @@ - should work with data.frames, zoo, xts - create a generic "eventstudies" class - DESIGN!!! - + - Change the main package description to: + "eventstudies: An R package for researchers and users of event + studies" + - on Rforge + - inside the package + - CRAN + * phys2eventtime - more testing: all output is unitmissing - parallelise (provide an argument to the user) @@ -34,3 +40,4 @@ * Testing - manual calculation of numbers in the tests + - revert old tests? From noreply at r-forge.r-project.org Tue Mar 18 21:40:21 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 18 Mar 2014 21:40:21 +0100 (CET) Subject: [Eventstudies-commits] r200 - pkg/man Message-ID: <20140318204021.A03601846A6@r-forge.r-project.org> Author: chiraganand Date: 2014-03-18 21:40:21 +0100 (Tue, 18 Mar 2014) New Revision: 200 Modified: pkg/man/manyfirmssubperiod.lmAMM.Rd Log: Formatting changes. Modified: pkg/man/manyfirmssubperiod.lmAMM.Rd =================================================================== --- pkg/man/manyfirmssubperiod.lmAMM.Rd 2014-03-16 13:31:01 UTC (rev 199) +++ pkg/man/manyfirmssubperiod.lmAMM.Rd 2014-03-18 20:40:21 UTC (rev 200) @@ -4,35 +4,41 @@ \title{A function to compute AMM for multiple firms across several periods} -\description{ - This function will compute AMM for multiple firms at once using the - matrix of data obtained from \code{makeX}, and a matrix of LHS variables} +\description{This function runs AMM for multiple firms at once using + the matrix of data obtained from \code{makeX}, and a matrix of LHS + variables.} \usage{ -manyfirmssubperiod.lmAMM(firm.returns, X, lags, dates = NULL, periodnames = NULL, verbose = FALSE) +manyfirmssubperiod.lmAMM(firm.returns, + X, + lags, + dates = NULL, + periodnames = NULL, + verbose = FALSE) } \arguments{ - \item{firm.returns}{A zoo matrix of all firms for which AMM is to - be computed} - \item{X}{A zoo matrix containing at least two - regressors generally obtained after applying the makeX function } + \item{firm.returns}{A \pkg{zoo} object of all firms on which AMM is to be + run.} - \item{lags}{ Specifies the number of lags to be used in the - market model} + \item{X}{a \pkg{zoo} object containing at least two regressors + generally obtained after applying the \dQuote{makeX} function.} - \item{dates}{A set of dates that mark out subperiods of - interest. If dates is NULL then full period is considered.} + \item{lags}{an integer specifying the number of lags to be used in the + market model.} - \item{periodnames}{Name for each subperiod that has been marked - by the dates above.} + \item{dates}{a set of dates that mark out subperiods of interest. If + dates is NULL, then full period is considered.} - \item{verbose}{Whether detailed print while running this - function is required} + \item{periodnames}{a \sQuote{character} vector of names for each + subperiod that has been marked by the \dQuote{dates} argument.} + + \item{verbose}{Whether to print detailed output. Default is \sQuote{FALSE}} } -\section{Warning}{Do not have any space between names provided under 'periodnames'} +\section{Warning}{Do not have any space between names provided under + \dQuote{periodnames}.} \author{Ajay Shah, Vimal Balasubramaniam} @@ -41,21 +47,32 @@ } \examples{ -# Running manyfirmssubperiod.lmAMM() involves as many steps as working with onefirmAMM. + +## Running manyfirmssubperiod.lmAMM() involves as many steps as working +## with onefirmAMM. data("lmAMMData") -firm.returns <- lmAMMData[,c("Infosys","TCS")] -market.returns <- lmAMMData[,"index.nifty"] -currency.returns <- lmAMMData[,"currency.inrusd"] + +firm.returns <- lmAMMData[, c("Infosys","TCS")] +market.returns <- lmAMMData[, "index.nifty"] +currency.returns <- lmAMMData[, "currency.inrusd"] + ## Creating X for AMM estimation using makeX function -X <- makeX(market.returns, others=currency.returns, nlags=1, - switch.to.innov=FALSE, market.returns.purge=FALSE, verbose=FALSE, - dates=as.Date(c("2012-02-01","2013-01-01","2014-01-20"))) +X <- makeX(market.returns, + others = currency.returns, + nlags = 1, + switch.to.innov = FALSE, + market.returns.purge = FALSE, + verbose = FALSE, + dates = as.Date(c("2012-02-01", "2013-01-01", "2014-01-20"))) + ## Estimating exposure -res <- manyfirmssubperiod.lmAMM(firm.returns,X,lags=1, - dates=as.Date(c("2012-02-01","2013-01-01","2014-01-20")), - periodnames=c("P1","P2"), - verbose=FALSE) +res <- manyfirmssubperiod.lmAMM(firm.returns = firm.returns, + X = X, + lags = 1, + dates = as.Date(c("2012-02-01", "2013-01-01", "2014-01-20")), + periodnames = c("P1", "P2"), + verbose = FALSE) print(res) } -\keyword{manyfirmssubperiod.lmAMM} \ No newline at end of file +\keyword{manyfirmssubperiod.lmAMM} From noreply at r-forge.r-project.org Tue Mar 18 21:44:15 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 18 Mar 2014 21:44:15 +0100 (CET) Subject: [Eventstudies-commits] r201 - pkg/man Message-ID: <20140318204415.46609184E62@r-forge.r-project.org> Author: chiraganand Date: 2014-03-18 21:44:14 +0100 (Tue, 18 Mar 2014) New Revision: 201 Modified: pkg/man/marketResidual.Rd Log: Formatting changes. Modified: pkg/man/marketResidual.Rd =================================================================== --- pkg/man/marketResidual.Rd 2014-03-18 20:40:21 UTC (rev 200) +++ pkg/man/marketResidual.Rd 2014-03-18 20:44:14 UTC (rev 201) @@ -1,30 +1,32 @@ \name{marketResidual} \alias{marketResidual} -\title{This function extracts market return from the firm return } +\title{This function extracts market return from the firm return.} -\description{ This function extracts market return using regression from the firm return to get the residual return -} +\description{This function extracts market return using regression from + the firm return to get the residual return. } -\usage{marketResidual(firm.returns, market.returns) -} +\usage{marketResidual(firm.returns, market.returns)} \arguments{ - \item{firm.returns}{Single time series object with all firm returns} - \item{market.returns}{Market index returns} + \item{firm.returns}{a \pkg{zoo} time series object with all firm returns.} + + \item{market.returns}{a \pkg{zoo} time series of market index returns.} } -\value{ Market residual after extracting market returns from the firm return -} +\value{Market residual after extracting market returns from the firm + return.} + \author{Vikram Bahure} \examples{ data(StockPriceReturns) data(nifty.index) -# Extracting market residual -mm.result <- marketResidual(firm.returns=StockPriceReturns, market.returns=nifty.index) +mm.result <- marketResidual(firm.returns = StockPriceReturns, + market.returns = nifty.index) + } \keyword{marketResidual} From noreply at r-forge.r-project.org Tue Mar 18 21:49:18 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 18 Mar 2014 21:49:18 +0100 (CET) Subject: [Eventstudies-commits] r202 - pkg/man Message-ID: <20140318204918.342EF1866ED@r-forge.r-project.org> Author: chiraganand Date: 2014-03-18 21:49:17 +0100 (Tue, 18 Mar 2014) New Revision: 202 Modified: pkg/man/mmData.Rd Log: Some text changes. Modified: pkg/man/mmData.Rd =================================================================== --- pkg/man/mmData.Rd 2014-03-18 20:44:14 UTC (rev 201) +++ pkg/man/mmData.Rd 2014-03-18 20:49:17 UTC (rev 202) @@ -2,12 +2,14 @@ \alias{mmData} -\title{Data for testing the market model and examples therein} +\title{Data for testing the market model and use with examples.} -\description{This is a zoo data that is used for testing purposes} +\description{This data is only used for testing.} \usage{data(mmData)} +\format{\pkg{zoo}} + \author{Vikram Bahure} \examples{ @@ -16,4 +18,4 @@ str(mmData) } -\keyword{mmData} \ No newline at end of file +\keyword{mmData} From noreply at r-forge.r-project.org Tue Mar 18 21:51:07 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 18 Mar 2014 21:51:07 +0100 (CET) Subject: [Eventstudies-commits] r203 - pkg/man Message-ID: <20140318205107.12FBF186772@r-forge.r-project.org> Author: chiraganand Date: 2014-03-18 21:51:06 +0100 (Tue, 18 Mar 2014) New Revision: 203 Modified: pkg/man/nifty.index.Rd Log: Fixed spelling mistakes. Modified: pkg/man/nifty.index.Rd =================================================================== --- pkg/man/nifty.index.Rd 2014-03-18 20:49:17 UTC (rev 202) +++ pkg/man/nifty.index.Rd 2014-03-18 20:51:06 UTC (rev 203) @@ -1,15 +1,16 @@ \name{nifty.index} \alias{nifty.index} \docType{data} -\title{ -NSE Nifty index from 2004 to 2012 -} -\description{ -A sample of Nifty index return from 1990 to 2012. It is stored as an tim series object object. -} + +\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{ It is an time series object containing daily data from 2003 to 2012. The format is: chr 'nifty.index.rda' -} + +\format{\pkg{zoo}} + \examples{ data(nifty.index) } From noreply at r-forge.r-project.org Tue Mar 18 22:11:43 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 18 Mar 2014 22:11:43 +0100 (CET) Subject: [Eventstudies-commits] r204 - pkg/man Message-ID: <20140318211143.AE92B18466A@r-forge.r-project.org> Author: chiraganand Date: 2014-03-18 22:11:43 +0100 (Tue, 18 Mar 2014) New Revision: 204 Modified: pkg/man/remap.cumprod.Rd Log: Formatting changes, added FIXME for the example. Modified: pkg/man/remap.cumprod.Rd =================================================================== --- pkg/man/remap.cumprod.Rd 2014-03-18 20:51:06 UTC (rev 203) +++ pkg/man/remap.cumprod.Rd 2014-03-18 21:11:43 UTC (rev 204) @@ -1,23 +1,27 @@ \name{remap.cumprod} \alias{remap.cumprod} -\title{Returns geometric returns.} +\title{Compute geometric returns.} -\description{This function returns the geometric returns for a given zoo object.} +\description{This function computes the geometric returns for a given + \pkg{zoo} object.} \usage{remap.cumprod(z, is.pc = TRUE, is.returns = TRUE, base = 100)} \arguments{ - \item{z}{z is the zoo object returned from phys2eventtime.} - \item{is.pc}{Logical flag if input is a percentage.} + \item{z}{a \pkg{zoo} object indexed by event time, as returned from + \dQuote{phys2eventtime}.} - \item{is.returns}{Logical flag if input is returns.} + \item{is.pc}{\sQuote{logical}, whether input is a percentage.} - \item{base}{The base for the cumulative product.} + \item{is.returns}{\sQuote{logical}, whether input is returns.} + + \item{base}{an integer specifying the base for cumulative product.} } -\value{The frame returned has each column replaced by base * the cumulative product of the column.} +\value{A \pkg{zoo} series is returned with each column replaced by the + product of \dQuote{base} and the cumulative product of the column.} \seealso{ phys2eventtime @@ -26,8 +30,16 @@ \examples{ data(StockPriceReturns) data(SplitDates) -es.results <- phys2eventtime(z=StockPriceReturns, events=SplitDates,width=5) -es.w <- window(es.results$z.e, start=-5, end=+5) -eventtime <- remap.cumprod(es.w, is.pc=FALSE, is.returns=TRUE, base=0) + +es.results <- phys2eventtime(z = StockPriceReturns, + events = SplitDates, + width = 5) +es.w <- window(es.results$z.e, start = -5, end = +5) + +%% FIXME: is base=0 good an example? +eventtime <- remap.cumprod(es.w, + is.pc = FALSE, + is.returns = TRUE, + base = 0) } From noreply at r-forge.r-project.org Tue Mar 18 22:16:23 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 18 Mar 2014 22:16:23 +0100 (CET) Subject: [Eventstudies-commits] r205 - pkg/man Message-ID: <20140318211623.6EBDC1861EB@r-forge.r-project.org> Author: chiraganand Date: 2014-03-18 22:16:23 +0100 (Tue, 18 Mar 2014) New Revision: 205 Modified: pkg/man/remap.cumsum.Rd Log: Formatting changes. Modified: pkg/man/remap.cumsum.Rd =================================================================== --- pkg/man/remap.cumsum.Rd 2014-03-18 21:11:43 UTC (rev 204) +++ pkg/man/remap.cumsum.Rd 2014-03-18 21:16:23 UTC (rev 205) @@ -1,36 +1,40 @@ \name{remap.cumsum} \alias{remap.cumsum} -\title{ -This function gives the cumulative total of the values ( in level or percentage form ). -} + +\title{This function gives the cumulative total of the values (in + level or percentage form).} + \description{ -This function gives the cumulative total of the values. + This function gives the cumulative total of the values. } + \usage{ remap.cumsum(z, is.pc = TRUE, base = 0) } + \arguments{ - \item{z}{ -z is the zoo object returned from phys2eventtime. + \item{z}{a \pkg{zoo} object indexed by event time, as returned from + \dQuote{phys2eventtime}.} + + \item{is.pc}{\sQuote{logical}, whether input is a percentage.} + + \item{base}{an integer specifying the base for cumulative sum.} } - \item{is.pc}{ -is.pc is a logical flag to indicate that the values are in percentage form. -} - \item{base}{ -base for the cumulative sum (default: base = 0). -} -} -\value{ -The frame returned has each column replaced by the cumulative sum of the column. -} + +\value{A \pkg{zoo} series is returned having each column replaced by + the cumulative sum of the column.} + \seealso{ -eventDays, eventstudyData, phys2eventtime + eventDays, eventstudyData, phys2eventtime } + \examples{ data(StockPriceReturns) data(SplitDates) -es.results <- phys2eventtime(z=StockPriceReturns, events=SplitDates,width=5) -es.w <- window(es.results$z.e, start=-5, end=+5) -eventtime <- remap.cumsum(es.w, is.pc=FALSE, base=0) + +es.results <- phys2eventtime(z = StockPriceReturns, + events = SplitDates, + width = 5) +es.w <- window(es.results$z.e, start = -5, end = +5) +eventtime <- remap.cumsum(es.w, is.pc = FALSE, base = 0) } - From noreply at r-forge.r-project.org Tue Mar 18 22:20:31 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 18 Mar 2014 22:20:31 +0100 (CET) Subject: [Eventstudies-commits] r206 - pkg/man Message-ID: <20140318212031.50B4E1866A1@r-forge.r-project.org> Author: chiraganand Date: 2014-03-18 22:20:31 +0100 (Tue, 18 Mar 2014) New Revision: 206 Modified: pkg/man/remap.event.reindex.Rd Log: Added fixme, description needs to change. Modified: pkg/man/remap.event.reindex.Rd =================================================================== --- pkg/man/remap.event.reindex.Rd 2014-03-18 21:16:23 UTC (rev 205) +++ pkg/man/remap.event.reindex.Rd 2014-03-18 21:20:31 UTC (rev 206) @@ -1,13 +1,17 @@ \name{remap.event.reindex} \alias{remap.event.reindex} -\title{This function sets the value at event date to be 100 and the other values relative to this value.} +\title{This function remaps the event date to 100, and other values + relative to the remapped event date.} +%% FIXME: needs to be rewritten. +\description{A function which consumes a zoo object where there are lots + of events (as columns). The contents are all levels. For each column, + the event date value is set to 100 and all other values are scaled + accordingly. It's input is a zoo object which is the first component of + the list returned by phys2eventtime. +} -\description{A function which consumes a zoo object where there are lots of events (as columns). The contents are all levels. -For each column, the event date value is set to 100 and all other values are scaled accordingly. -It's input is a zoo object which is the first component of the list returned by phys2eventtime.} - \usage{remap.event.reindex(z)} \arguments{ From noreply at r-forge.r-project.org Thu Mar 20 18:42:44 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 20 Mar 2014 18:42:44 +0100 (CET) Subject: [Eventstudies-commits] r207 - pkg/R Message-ID: <20140320174244.9C9EC1840B2@r-forge.r-project.org> Author: vikram Date: 2014-03-20 18:42:44 +0100 (Thu, 20 Mar 2014) New Revision: 207 Modified: pkg/R/ees.R Log: Fixed eesPlot error. Modified: pkg/R/ees.R =================================================================== --- pkg/R/ees.R 2014-03-18 21:20:31 UTC (rev 206) +++ pkg/R/ees.R 2014-03-20 17:42:44 UTC (rev 207) @@ -816,7 +816,7 @@ # Replaing NA's with zeroes es.w[is.na(es.w)] <- 0 es.w <- remap.cumsum(es.w, is.pc=FALSE, base=0) - inference.bootstrap(es.w) + inference.bootstrap(es.w,to.plot=FALSE) } #---------------------------------- From noreply at r-forge.r-project.org Thu Mar 20 20:21:12 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 20 Mar 2014 20:21:12 +0100 (CET) Subject: [Eventstudies-commits] r208 - pkg/man Message-ID: <20140320192112.3B7311864DC@r-forge.r-project.org> Author: vikram Date: 2014-03-20 20:21:11 +0100 (Thu, 20 Mar 2014) New Revision: 208 Modified: pkg/man/eventstudy.Rd Log: Modified man page; Work in progress Modified: pkg/man/eventstudy.Rd =================================================================== --- pkg/man/eventstudy.Rd 2014-03-20 17:42:44 UTC (rev 207) +++ pkg/man/eventstudy.Rd 2014-03-20 19:21:11 UTC (rev 208) @@ -3,7 +3,7 @@ \title{Event study analysis} -\description{Function to compute event study inference using different inference strategies for various market models.} +\description{Function to perform event study analysis and compute confidence intervals} \usage{ eventstudy(firm.returns = NULL, @@ -30,20 +30,18 @@ } \item{width}{ % FIXME: needs better description - \sQuote{integer} of length 1, it studies the performance of observations before and - after the event + \sQuote{integer} of length 1, which creates an event window to study the impact (pre and post event) on the variable } \item{type}{ a scalar of type \sQuote{character}, specifying the market model adjustment. Currently supported options are: - \dQuote{marketResidual}, \dQuote{excessReturn}, \dQuote{AMM} and + \dQuote{marketResidual}, \dQuote{excessReturn}, \dQuote{lmAMM} and \dQuote{None}. Defaults to \dQuote{marketResidual}. See \sQuote{Details}. } \item{to.remap}{ - \sQuote{logical}, indicating if remap of the event frame should be - done. + \sQuote{logical}, indicating whether to convert event-window returns into cumulative sum, cumulative product or re-index } \item{remap}{ % FIXME: list all the possible @@ -51,8 +49,8 @@ % explanation of the purpose of % the argument \sQuote{character}, this argument is used when \dQuote{to.remap} is - \sQuote{TRUE} to estimate cumulative sum (cumsum), cumulative - product (cumprod) or reindex the event frame. + \sQuote{TRUE}, which estimates cumulative sum (cumsum), cumulative + product (cumprod) or reindex the event frame. Currently supported options are \dQuote{cumsum}, \dQuote{cumprod}, \dQuote{reindex}. Defaults to \dQuote{cumsum}. } \item{is.levels}{ @@ -68,7 +66,7 @@ \item{inference.strategy}{ % FIXME: list all the possible options a \sQuote{character} scalar specifying the inference strategy to compute confidence intervals. Is used only if \dQuote{inference} is - \sQuote{TRUE}. Defaults to \dQuote{bootstrap}. + \sQuote{TRUE}. Currently supported options are \dQuote{bootstrap}, \dQuote{wilcox}.Defaults to \dQuote{bootstrap}. } \item{...}{ From noreply at r-forge.r-project.org Fri Mar 21 06:26:10 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 21 Mar 2014 06:26:10 +0100 (CET) Subject: [Eventstudies-commits] r209 - pkg/man Message-ID: <20140321052610.42F961868F8@r-forge.r-project.org> Author: vikram Date: 2014-03-21 06:26:06 +0100 (Fri, 21 Mar 2014) New Revision: 209 Modified: pkg/man/StockPriceReturns.Rd pkg/man/eventstudy.Rd pkg/man/lmAMM.Rd pkg/man/makeX.Rd pkg/man/phys2eventtime.Rd pkg/man/remap.cumprod.Rd pkg/man/remap.event.reindex.Rd Log: Modified the man pages Modified: pkg/man/StockPriceReturns.Rd =================================================================== --- pkg/man/StockPriceReturns.Rd 2014-03-20 19:21:11 UTC (rev 208) +++ pkg/man/StockPriceReturns.Rd 2014-03-21 05:26:06 UTC (rev 209) @@ -6,7 +6,7 @@ \title{An example dataset of stock price returns to perform eventstudy analysis.} -% FIXME: Remove NAs in the dataset? +% FIXME: Remove NAs in the dataset? If we do complete.cases then all rows will be removed \description{This data set contains stock price returns of 30 major stocks on the National Stock Exchange (NSE) of India for a period of 23 years.} Modified: pkg/man/eventstudy.Rd =================================================================== --- pkg/man/eventstudy.Rd 2014-03-20 19:21:11 UTC (rev 208) +++ pkg/man/eventstudy.Rd 2014-03-21 05:26:06 UTC (rev 209) @@ -44,13 +44,13 @@ \sQuote{logical}, indicating whether to convert event-window returns into cumulative sum, cumulative product or re-index } - \item{remap}{ % FIXME: list all the possible - % options properly. Needs better - % explanation of the purpose of - % the argument + \item{remap}{ \sQuote{character}, this argument is used when \dQuote{to.remap} is - \sQuote{TRUE}, which estimates cumulative sum (cumsum), cumulative - product (cumprod) or reindex the event frame. Currently supported options are \dQuote{cumsum}, \dQuote{cumprod}, \dQuote{reindex}. Defaults to \dQuote{cumsum}. + \sQuote{TRUE}. Provides four options: \cr + \dQuote{cumsum}: Cumulative sum \cr + \dQuote{cumprod}: Cumulative product, buy-hold-abnormal-return (BHAR) \cr + \dQuote{reindex}: re-indexing the event window. \cr + Defaults to \dQuote{cumsum}. } \item{is.levels}{ Modified: pkg/man/lmAMM.Rd =================================================================== --- pkg/man/lmAMM.Rd 2014-03-20 19:21:11 UTC (rev 208) +++ pkg/man/lmAMM.Rd 2014-03-21 05:26:06 UTC (rev 209) @@ -39,11 +39,9 @@ \item{exposures}{a \sQuote{numeric} containing exposure estimates for the firm j.} - %% FIXME: "for the firm firm.returns" doesn't make sense. Is it "for - %% the firm with returns 'firm.returns'? \item{s.exposures}{a \sQuote{numeric} containing the HAC adjusted standard error of the exposures estimated for the firm - firm.returns.} + with returns \sQuote{firm.returns}.} \item{nlags}{shows the lag length provided by user.} } Modified: pkg/man/makeX.Rd =================================================================== --- pkg/man/makeX.Rd 2014-03-20 19:21:11 UTC (rev 208) +++ pkg/man/makeX.Rd 2014-03-21 05:26:06 UTC (rev 209) @@ -20,12 +20,13 @@ \arguments{ %% FIXME: our example contains univariate time-series object. Can it - %% accept multiple columns as input? + %% accept multiple columns as input? Here we are only supposed to use one column \item{market.returns}{a \pkg{zoo} timeseries object. This is generally fixed to the stock market index. The first column vector of this matrix contains this variable. } %% FIXME: same as market.returns: can it contain more than one variable? + %% This variable is supported to take more than one variables. \item{others}{A zoo matrix with other regressors of interest in the AMM. This could be currency, bond returns, foreign flows, or any other variable.} @@ -34,14 +35,10 @@ each column in \dQuote{others}. Whether to switch the column from raw values to AR residuals.} - %% FIXME: Second part of the sentence (i.e.) is somewhat unclear. - \item{market.returns.purge}{Whether to purge the effects - \dQuote{others} from \dQuote{market.returns} (i.e., is it replaced by - residuals of a model explaining market.returns using all these - 'others').} + \item{market.returns.purge}{a \sQuote{logical} element, indicating whether to purge the effects of \dQuote{others} from \dQuote{market.returns}. } \item{nlags}{The number of lag terms present in this model explaining - market.returns using all these \dQuote{others}.} + \dQuote{market.returns} using all these \dQuote{others}.} \item{dates}{Specified break dates as \sQuote{Date} object (either from structural breaks in exchange rate regimes) so that all these steps @@ -51,9 +48,8 @@ \sQuote{FALSE}}. } -%% FIXME: Provide a reason why there shouldn't be NAs. -\section{Warning}{The input data should not contain \sQuote{NA}s. Please - use \sQuote{na.omit} before feeding data into this function.} +\section{Warning}{The input data should not contain \sQuote{NA}s as required by \dQuote{lm} function to compute linear estimates. Please use \sQuote{na.omit} before feeding data into this function.} + \value{This function generates a user specified matrix of explanatory variables that will be further used in running Augmented market Modified: pkg/man/phys2eventtime.Rd =================================================================== --- pkg/man/phys2eventtime.Rd 2014-03-20 19:21:11 UTC (rev 208) +++ pkg/man/phys2eventtime.Rd 2014-03-21 05:26:06 UTC (rev 209) @@ -18,7 +18,7 @@ which the event frame is to be generated. See \sQuote{Details}.} %% FIXME: should remove this description from eventstudy.Rd, and point - %% it here? + %% it here? eventstudy is a general function, it will need all args description? \item{events}{ \sQuote{data.frame} of two columns containing event dates. \dQuote{outcome.unit} consists of column names of the event @@ -47,11 +47,17 @@ Returns a \sQuote{list} of two elements: \item{z.e}{a zoo object indexed with event time.} - %% FIXME: list all the options here instead of writing them inside - %% eventstudy.Rd? - \item{outcomes}{a \sQuote{character} vector containing the - status of each \dQuote{outcome.unit}. - } + \item{outcomes}{ + a \sQuote{character} vector having outcome of each event + date. Provides four outcomes: \cr + \dQuote{success}: shows the successful use of event date. \cr + \dQuote{wdatamissing}: appears when width data is missing around + the event. \cr + \dQuote{wrongspan}: if event date falls outside the range of physical + date. \cr + \dQuote{unimissing}: when the unit (firm name) is missing in the event + list. + } } \examples{ Modified: pkg/man/remap.cumprod.Rd =================================================================== --- pkg/man/remap.cumprod.Rd 2014-03-20 19:21:11 UTC (rev 208) +++ pkg/man/remap.cumprod.Rd 2014-03-21 05:26:06 UTC (rev 209) @@ -30,16 +30,13 @@ \examples{ data(StockPriceReturns) data(SplitDates) - es.results <- phys2eventtime(z = StockPriceReturns, events = SplitDates, width = 5) es.w <- window(es.results$z.e, start = -5, end = +5) - -%% FIXME: is base=0 good an example? eventtime <- remap.cumprod(es.w, - is.pc = FALSE, + is.pc = TRUE, is.returns = TRUE, - base = 0) + base = 100) } Modified: pkg/man/remap.event.reindex.Rd =================================================================== --- pkg/man/remap.event.reindex.Rd 2014-03-20 19:21:11 UTC (rev 208) +++ pkg/man/remap.event.reindex.Rd 2014-03-21 05:26:06 UTC (rev 209) @@ -1,15 +1,11 @@ \name{remap.event.reindex} \alias{remap.event.reindex} -\title{This function remaps the event date to 100, and other values - relative to the remapped event date.} +\title{Remaps the event date to 100 and remaps other values in event window} %% FIXME: needs to be rewritten. -\description{A function which consumes a zoo object where there are lots - of events (as columns). The contents are all levels. For each column, - the event date value is set to 100 and all other values are scaled - accordingly. It's input is a zoo object which is the first component of - the list returned by phys2eventtime. +\description{This function remaps the event date to 100, and other values + relative to the remapped event date. } \usage{remap.event.reindex(z)} From noreply at r-forge.r-project.org Fri Mar 21 07:31:28 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 21 Mar 2014 07:31:28 +0100 (CET) Subject: [Eventstudies-commits] r210 - in pkg: man vignettes Message-ID: <20140321063128.26BEE186D57@r-forge.r-project.org> Author: vikram Date: 2014-03-21 07:31:27 +0100 (Fri, 21 Mar 2014) New Revision: 210 Modified: pkg/man/StockPriceReturns.Rd pkg/vignettes/amm.Rnw Log: Fixed AMM vignette R code Modified: pkg/man/StockPriceReturns.Rd =================================================================== --- pkg/man/StockPriceReturns.Rd 2014-03-21 05:26:06 UTC (rev 209) +++ pkg/man/StockPriceReturns.Rd 2014-03-21 06:31:27 UTC (rev 210) @@ -4,7 +4,7 @@ \alias{StockPriceReturns} -\title{An example dataset of stock price returns to perform eventstudy analysis.} +\title{An example dataset of stock price returns to perform event study analysis.} % FIXME: Remove NAs in the dataset? If we do complete.cases then all rows will be removed \description{This data set contains stock price returns of 30 major Modified: pkg/vignettes/amm.Rnw =================================================================== --- pkg/vignettes/amm.Rnw 2014-03-21 05:26:06 UTC (rev 209) +++ pkg/vignettes/amm.Rnw 2014-03-21 06:31:27 UTC (rev 210) @@ -115,7 +115,7 @@ tmp.res <- zoo(tmp,as.Date(names(tmp))) } ## One firm -amm.output.one <- lmAMM(regressand[,1],X,nlags=1) +amm.output.one <- lmAMM(regressand[,1],X=regressors,nlags=1) amm.resid.one <- timeseries.lmAMM(firm.returns=regressand[,1], X=regressors, verbose=FALSE, nlags=1) summary(amm.output.one) @@ -123,7 +123,7 @@ ## More than one firm # Extracting and merging tmp.resid <- sapply(colnames(regressand)[1:2],function(y) - timeseriesAMM(firm.returns=regressand[,y], + timeseries.lmAMM(firm.returns=regressand[,y], X=regressors, verbose=FALSE, nlags=1)) @@ -159,7 +159,7 @@ deprintize<-function(f){ return(function(...) {capture.output(w<-f(...));return(w);}); } -firm.exposure <- deprintize(subperiod.lmAMM)(firm.returns=firm.returns, +firm.exposure <- deprintize(subperiod.lmAMM)(firm.returns=regressand[,1], X=regressors, nlags=1, verbose=TRUE, From noreply at r-forge.r-project.org Mon Mar 24 20:31:44 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Mon, 24 Mar 2014 20:31:44 +0100 (CET) Subject: [Eventstudies-commits] r211 - pkg/data Message-ID: <20140324193144.7A83A186A53@r-forge.r-project.org> Author: chiraganand Date: 2014-03-24 20:31:44 +0100 (Mon, 24 Mar 2014) New Revision: 211 Modified: pkg/data/StockPriceReturns.rda Log: Removed top and bottom NAs from the dataset. Modified: pkg/data/StockPriceReturns.rda =================================================================== (Binary files differ) From noreply at r-forge.r-project.org Mon Mar 24 20:39:32 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Mon, 24 Mar 2014 20:39:32 +0100 (CET) Subject: [Eventstudies-commits] r212 - pkg/man Message-ID: <20140324193932.DDE18184E18@r-forge.r-project.org> Author: chiraganand Date: 2014-03-24 20:39:32 +0100 (Mon, 24 Mar 2014) New Revision: 212 Modified: pkg/man/eventstudy.Rd Log: Small changes to text. Modified: pkg/man/eventstudy.Rd =================================================================== --- pkg/man/eventstudy.Rd 2014-03-24 19:31:44 UTC (rev 211) +++ pkg/man/eventstudy.Rd 2014-03-24 19:39:32 UTC (rev 212) @@ -30,26 +30,26 @@ } \item{width}{ % FIXME: needs better description - \sQuote{integer} of length 1, which creates an event window to study the impact (pre and post event) on the variable + integer of length 1, which creates an event window to study the impact (pre and post event) on the variable. } \item{type}{ - a scalar of type \sQuote{character}, specifying the market + a scalar of type \sQuote{character} specifying the market model adjustment. Currently supported options are: \dQuote{marketResidual}, \dQuote{excessReturn}, \dQuote{lmAMM} and \dQuote{None}. Defaults to \dQuote{marketResidual}. See \sQuote{Details}. } - \item{to.remap}{ - \sQuote{logical}, indicating whether to convert event-window returns into cumulative sum, cumulative product or re-index + \item{to.remap}{ + \sQuote{logical}, indicating whether to convert event-window returns into cumulative sum, cumulative product, or re-index. } \item{remap}{ \sQuote{character}, this argument is used when \dQuote{to.remap} is - \sQuote{TRUE}. Provides four options: \cr - \dQuote{cumsum}: Cumulative sum \cr - \dQuote{cumprod}: Cumulative product, buy-hold-abnormal-return (BHAR) \cr - \dQuote{reindex}: re-indexing the event window. \cr + \sQuote{TRUE}. Takes three values: + \item{cumsum}{Cumulative sum} + \item{cumprod}{Cumulative product, buy-hold-abnormal-return (BHAR).} + \item{reindex}{Re-indexing the event window.} Defaults to \dQuote{cumsum}. } From noreply at r-forge.r-project.org Mon Mar 24 20:51:41 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Mon, 24 Mar 2014 20:51:41 +0100 (CET) Subject: [Eventstudies-commits] r213 - pkg/man Message-ID: <20140324195141.B1262186AB8@r-forge.r-project.org> Author: chiraganand Date: 2014-03-24 20:51:41 +0100 (Mon, 24 Mar 2014) New Revision: 213 Modified: pkg/man/makeX.Rd Log: Removed a fixme, some small text changes. Modified: pkg/man/makeX.Rd =================================================================== --- pkg/man/makeX.Rd 2014-03-24 19:39:32 UTC (rev 212) +++ pkg/man/makeX.Rd 2014-03-24 19:51:41 UTC (rev 213) @@ -25,9 +25,7 @@ fixed to the stock market index. The first column vector of this matrix contains this variable. } - %% FIXME: same as market.returns: can it contain more than one variable? - %% This variable is supported to take more than one variables. - \item{others}{A zoo matrix with other regressors of interest in the + \item{others}{a \pkg{zoo} matrix with other regressors of interest in the AMM. This could be currency, bond returns, foreign flows, or any other variable.} @@ -35,7 +33,9 @@ each column in \dQuote{others}. Whether to switch the column from raw values to AR residuals.} - \item{market.returns.purge}{a \sQuote{logical} element, indicating whether to purge the effects of \dQuote{others} from \dQuote{market.returns}. } + \item{market.returns.purge}{a \sQuote{logical} element, indicating + whether to purge the effects of \dQuote{others} from + \dQuote{market.returns}.} \item{nlags}{The number of lag terms present in this model explaining \dQuote{market.returns} using all these \dQuote{others}.} @@ -45,10 +45,12 @@ are constructed within each sub-period divided by the dates.} \item{verbose}{Whether detailed output is required. Default is - \sQuote{FALSE}}. + \sQuote{FALSE}.} } -\section{Warning}{The input data should not contain \sQuote{NA}s as required by \dQuote{lm} function to compute linear estimates. Please use \sQuote{na.omit} before feeding data into this function.} +\section{Warning}{The input data should not contain \sQuote{NA}s, as is + required by the \dQuote{lm} function to compute linear estimates. Please use + \sQuote{na.omit} before feeding data into this function.} \value{This function generates a user specified matrix of explanatory From noreply at r-forge.r-project.org Mon Mar 24 21:14:20 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Mon, 24 Mar 2014 21:14:20 +0100 (CET) Subject: [Eventstudies-commits] r214 - pkg/man Message-ID: <20140324201420.36A31186FA1@r-forge.r-project.org> Author: chiraganand Date: 2014-03-24 21:14:19 +0100 (Mon, 24 Mar 2014) New Revision: 214 Modified: pkg/man/phys2eventtime.Rd Log: Modified value section formatting. Modified: pkg/man/phys2eventtime.Rd =================================================================== --- pkg/man/phys2eventtime.Rd 2014-03-24 19:51:41 UTC (rev 213) +++ pkg/man/phys2eventtime.Rd 2014-03-24 20:14:19 UTC (rev 214) @@ -17,8 +17,6 @@ \item{z}{an object of class \pkg{zoo} containing time series data for which the event frame is to be generated. See \sQuote{Details}.} - %% FIXME: should remove this description from eventstudy.Rd, and point - %% it here? eventstudy is a general function, it will need all args description? \item{events}{ \sQuote{data.frame} of two columns containing event dates. \dQuote{outcome.unit} consists of column names of the event @@ -45,19 +43,17 @@ \value{ Returns a \sQuote{list} of two elements: + \item{z.e}{a zoo object indexed with event time.} - \item{outcomes}{ - a \sQuote{character} vector having outcome of each event - date. Provides four outcomes: \cr - \dQuote{success}: shows the successful use of event date. \cr - \dQuote{wdatamissing}: appears when width data is missing around - the event. \cr - \dQuote{wrongspan}: if event date falls outside the range of physical - date. \cr - \dQuote{unimissing}: when the unit (firm name) is missing in the event - list. - } + \item{outcomes}{a character vector with outcome of each event date:} + + \itemize{ + \item{success: shows the successful use of event date.} + \item{wdatamissing: appears when width data is missing around the event.} + \item{wrongspan: if event date falls outside the range of physical date.} + \item{unitmissing: when the unit (firm name) is missing in the event list.} + } } \examples{ From noreply at r-forge.r-project.org Mon Mar 24 21:24:26 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Mon, 24 Mar 2014 21:24:26 +0100 (CET) Subject: [Eventstudies-commits] r215 - pkg/man Message-ID: <20140324202426.E7795187150@r-forge.r-project.org> Author: chiraganand Date: 2014-03-24 21:24:26 +0100 (Mon, 24 Mar 2014) New Revision: 215 Modified: pkg/man/eventstudy.Rd Log: Fixed formatting errors. Modified: pkg/man/eventstudy.Rd =================================================================== --- pkg/man/eventstudy.Rd 2014-03-24 20:14:19 UTC (rev 214) +++ pkg/man/eventstudy.Rd 2014-03-24 20:24:26 UTC (rev 215) @@ -29,9 +29,8 @@ stock, and \dQuote{event.when} is the respective event date. } - \item{width}{ % FIXME: needs better description - integer of length 1, which creates an event window to study the impact (pre and post event) on the variable. - } + \item{width}{integer of length 1, which creates an event window to + study the impact (pre and post event) on the variable.} \item{type}{ a scalar of type \sQuote{character} specifying the market @@ -40,17 +39,18 @@ \dQuote{None}. Defaults to \dQuote{marketResidual}. See \sQuote{Details}. } - \item{to.remap}{ - \sQuote{logical}, indicating whether to convert event-window returns into cumulative sum, cumulative product, or re-index. - } + \item{to.remap}{\sQuote{logical}, indicating whether to convert + event-window returns into cumulative sum, cumulative product, or + re-index.} \item{remap}{ \sQuote{character}, this argument is used when \dQuote{to.remap} is - \sQuote{TRUE}. Takes three values: - \item{cumsum}{Cumulative sum} - \item{cumprod}{Cumulative product, buy-hold-abnormal-return (BHAR).} - \item{reindex}{Re-indexing the event window.} - Defaults to \dQuote{cumsum}. + \sQuote{TRUE}. Takes three values (defaults to \dQuote{cumsum}): + \itemize{ + \item{cumsum: cumulative sum.} + \item{cumprod: cumulative product, buy-hold-abnormal-return (BHAR).} + \item{reindex: re-indexing the event window.} + } } \item{is.levels}{ @@ -63,11 +63,10 @@ for the estimator. } - \item{inference.strategy}{ % FIXME: list all the possible options - a \sQuote{character} scalar specifying the inference strategy to - compute confidence intervals. Is used only if \dQuote{inference} is - \sQuote{TRUE}. Currently supported options are \dQuote{bootstrap}, \dQuote{wilcox}.Defaults to \dQuote{bootstrap}. - } + \item{inference.strategy}{a \sQuote{character} scalar specifying the + inference strategy to compute confidence intervals. Is used only if + \dQuote{inference} is \sQuote{TRUE}. Currently supported options are + \dQuote{bootstrap} and \dQuote{wilcox}. Defaults to \dQuote{bootstrap}.} \item{...}{ further arguments to pass to the model. @@ -88,16 +87,13 @@ interval. } - \item{outcomes}{ - a \sQuote{character} vector having outcome of each event - date. Provides four outcomes: \cr - \dQuote{success}: shows the successful use of event date. \cr - \dQuote{wdatamissing}: appears when width data is missing around - the event. \cr - \dQuote{wrongspan}: if event date falls outside the range of physical - date. \cr - \dQuote{unimissing}: when the unit (firm name) is missing in the event - list. + \item{outcomes}{a character vector having outcome of each event date:} + + \itemize{ + \item{success: shows the successful use of event date.} + \item{wdatamissing: appears when width data is missing around the event.} + \item{wrongspan: if event date falls outside the range of physical date.} + \item{unitmissing: when the unit (firm name) is missing in the event list.} } \item{inference}{ From noreply at r-forge.r-project.org Mon Mar 24 21:29:48 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Mon, 24 Mar 2014 21:29:48 +0100 (CET) Subject: [Eventstudies-commits] r216 - pkg/man Message-ID: <20140324202948.3DCDA187151@r-forge.r-project.org> Author: chiraganand Date: 2014-03-24 21:29:47 +0100 (Mon, 24 Mar 2014) New Revision: 216 Modified: pkg/man/remap.event.reindex.Rd Log: Reformatted the example. Modified: pkg/man/remap.event.reindex.Rd =================================================================== --- pkg/man/remap.event.reindex.Rd 2014-03-24 20:24:26 UTC (rev 215) +++ pkg/man/remap.event.reindex.Rd 2014-03-24 20:29:47 UTC (rev 216) @@ -22,7 +22,10 @@ \examples{ data(StockPriceReturns) data(SplitDates) -es.results <- phys2eventtime(z=StockPriceReturns, events=SplitDates,width=5) -es.w <- window(es.results$z.e, start=-5, end=+5) + +es.results <- phys2eventtime(z = StockPriceReturns, + events = SplitDates, + width = 5) +es.w <- window(es.results$z.e, start = -5, end = +5) eventtime <- remap.event.reindex(es.w) } From noreply at r-forge.r-project.org Mon Mar 24 22:47:13 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Mon, 24 Mar 2014 22:47:13 +0100 (CET) Subject: [Eventstudies-commits] r217 - pkg/R Message-ID: <20140324214713.B6C83186321@r-forge.r-project.org> Author: chiraganand Date: 2014-03-24 22:47:13 +0100 (Mon, 24 Mar 2014) New Revision: 217 Modified: pkg/R/eventstudy.R pkg/R/lmAmm.R Log: Fixed S3 generic function consistency. Modified: pkg/R/eventstudy.R =================================================================== --- pkg/R/eventstudy.R 2014-03-24 20:29:47 UTC (rev 216) +++ pkg/R/eventstudy.R 2014-03-24 21:47:13 UTC (rev 217) @@ -105,33 +105,33 @@ ######################### ## Functions for class es ######################### -print.es <- function(es.object){ - cat("The", es.object$inference, "inference output for CI and", - colnames(es.object$eventstudy.output)[2], "response:", "\n") - return(es.object$eventstudy.output) +print.es <- function(x, ...){ + cat("The", x$inference, "inference output for CI and", + colnames(x$eventstudy.output)[2], "response:", "\n") + return(x$eventstudy.output) } -summary.es <- function(es.object){ - cat("Event study", colnames(es.object$eventstudy.output)[2], "response with", - es.object$inference, "inference for CI:\n") - print(es.object$eventstudy.output) - cat("\n","Event outcome has",length(which(es.object$outcomes=="success")), - "successful outcomes out of", length(es.object$outcomes),"events:","\n") - es.object$outcomes +summary.es <- function(object, ...){ + cat("Event study", colnames(object$eventstudy.output)[2], "response with", + object$inference, "inference for CI:\n") + print(object$eventstudy.output) + cat("\n","Event outcome has",length(which(object$outcomes=="success")), + "successful outcomes out of", length(object$outcomes),"events:","\n") + object$outcomes } -plot.es <- function(es.object, xlab="Event time", +plot.es <- function(x, xlab="Event time", ylab="", main="", col.es="dark slate blue"){ - big <- max(abs(es.object$eventstudy.output)) + big <- max(abs(x$eventstudy.output)) hilo <- c(-big,big) - width <- (nrow(es.object$eventstudy.output)-1)/2 - plot(-width:width, es.object$eventstudy.output[,2], type="l", lwd=2, ylim=hilo, + width <- (nrow(x$eventstudy.output)-1)/2 + plot(-width:width, x$eventstudy.output[,2], type="l", lwd=2, ylim=hilo, col=col.es,xlab= xlab, ylab = ylab, main=paste(main)) - points(-width:width, es.object$eventstudy.output[,2]) - lines(-width:width, es.object$eventstudy.output[,"2.5%"], + points(-width:width, x$eventstudy.output[,2]) + lines(-width:width, x$eventstudy.output[,"2.5%"], lwd=1, lty=2, col=col.es) - lines(-width:width, es.object$eventstudy.output[,"97.5%"], + lines(-width:width, x$eventstudy.output[,"97.5%"], lwd=1, lty=2, col=col.es) abline(h=0,v=0) } Modified: pkg/R/lmAmm.R =================================================================== --- pkg/R/lmAmm.R 2014-03-24 20:29:47 UTC (rev 216) +++ pkg/R/lmAmm.R 2014-03-24 21:47:13 UTC (rev 217) @@ -331,28 +331,30 @@ ############################################ ## Summary, print and plot functions for AMM ############################################ -summary.amm <- function(amm) { +summary.amm <- function(object, ...) { cat("\n", "Summary statistics of exposure: \n") - sstats <- cbind(amm$exposure, amm$s.exposure, - amm$exposure/amm$s.exposure) + sstats <- cbind(object$exposure, object$s.exposure, + object$exposure/object$s.exposure) colnames(sstats) <- c("Exposure", "Std.Err", "t statistic") - rownames(sstats) <- names(amm$exposures) + rownames(sstats) <- names(object$exposures) print(sstats) - cat("\n","Linear model AMM results: ","\n"); class(amm) <- "lm"; print(summary(amm)) + cat("\n","Linear model AMM results: ","\n"); + class(object) <- "lm"; + print.default(summary.default(object)) } -print.amm <- function(amm){ +print.amm <- function(x, ...){ cat("\n") - print(amm$call) + print(x$call) cat("\n","Coefficients:","\n") - print(amm$coef) + print(x$coef) cat("\n","Exposures:","\n") - print(amm$exposures) + print.default(x$exposures) } -plot.amm <- function(amm){ - tmp.x <- zoo(as.numeric(resid(amm)), as.Date(names(resid(amm)))) - tmp.f <- zoo(amm$model$firm.returns, index(tmp.x)) +plot.amm <- function(x, ...){ + tmp.x <- zoo(as.numeric(resid(x)), as.Date(names(resid(x)))) + tmp.f <- zoo(x$model$firm.returns, index(tmp.x)) tmp <- merge(tmp.x,tmp.f) colnames(tmp) <- c("amm.residuals","firm.returns") plot(tmp, screen=1, lty=1:2, lwd=2, col=c("indian red", "navy blue"),ylab="", From noreply at r-forge.r-project.org Tue Mar 25 10:15:27 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 25 Mar 2014 10:15:27 +0100 (CET) Subject: [Eventstudies-commits] r218 - pkg/man Message-ID: <20140325091527.852B61868B4@r-forge.r-project.org> Author: vikram Date: 2014-03-25 10:15:27 +0100 (Tue, 25 Mar 2014) New Revision: 218 Removed: pkg/man/AMM.Rd Log: removing AMM.Rd which refers to old documentation Deleted: pkg/man/AMM.Rd =================================================================== --- pkg/man/AMM.Rd 2014-03-24 21:47:13 UTC (rev 217) +++ pkg/man/AMM.Rd 2014-03-25 09:15:27 UTC (rev 218) @@ -1,40 +0,0 @@ -\name{AMM} -\alias{AMM} - -\title{A function that estimates exposure for a single firm over multiple periods} - -\description{This function computes AMM residuals} - -\usage{ -AMM(...) -} - -\arguments{ - \item{...}{Accepts specific arguments for the model.} -} -\value{ This function computes AMM residual using onefirmAMM function. -} - -\author{Vikram Bahure} - -\seealso{ \code{\link{firmExposures}}, -\code{\link{onefirmAMM}}} - -\examples{ -# 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) - -## One firm -of <- AMM(firm.returns=Company_A, - verbose=FALSE, - market.returns=NIFTY_INDEX, others=INRUSD, - switch.to.innov=TRUE, market.returns.purge=TRUE, nlags=1) -} - -\keyword{AMM} From noreply at r-forge.r-project.org Tue Mar 25 14:42:41 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 25 Mar 2014 14:42:41 +0100 (CET) Subject: [Eventstudies-commits] r219 - pkg/vignettes Message-ID: <20140325134241.A2B31184C61@r-forge.r-project.org> Author: vikram Date: 2014-03-25 14:42:41 +0100 (Tue, 25 Mar 2014) New Revision: 219 Modified: pkg/vignettes/eventstudies.Rnw Log: Modified vignette code Modified: pkg/vignettes/eventstudies.Rnw =================================================================== --- pkg/vignettes/eventstudies.Rnw 2014-03-25 09:15:27 UTC (rev 218) +++ pkg/vignettes/eventstudies.Rnw 2014-03-25 13:42:41 UTC (rev 219) @@ -169,6 +169,12 @@ <<>>= data(SplitDates) 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 +inrusd <- all.data$inr @ \subsection{Calculating idiosyncratic returns} @@ -213,13 +219,6 @@ % AMM model <<>>= # Create RHS before running lmAMM() -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 -inrusd <- all.data$inr - ################### ## AMM residuals ## ################### @@ -238,7 +237,7 @@ ## More than one firm # Extracting and merging tmp.resid <- sapply(colnames(StockPriceReturns)[1:3],function(y) - timeseriesAMM(firm.returns=StockPriceReturns[,y], + timeseries.lmAMM(firm.returns=StockPriceReturns[,y], X=regressors, verbose=FALSE, nlags=1)) @@ -280,7 +279,7 @@ \textit{inference.bootstrap} performs the bootstrap to generate distribution of $\overline{CR}$. The bootstrap generates confidence interval at 2.5 percent and 97.5 percent for the estimate. <<>>= -result <- inference.bootstrap(es.w=es.cs, to.plot=TRUE) +result <- inference.bootstrap(es.w=es.cs, to.plot=FALSE) print(result) @ @@ -291,7 +290,11 @@ \setkeys{Gin}{width=0.8\linewidth} \setkeys{Gin}{height=0.8\linewidth} <>= -result <- inference.bootstrap(es.w=es.cs, to.plot=TRUE) +es.na.btsp <- eventstudy(firm.returns = StockPriceReturns, + eventList = SplitDates, width = 10, to.remap = TRUE, + remap = "cumsum", inference = TRUE, + inference.strategy = "bootstrap", type = "None") +plot.es(es.na.btsp) @ \end{center} \label{fig:one} @@ -301,8 +304,8 @@ Another non-parametric inference available and is used widely with event study analysis is the Wilcoxon signed rank test. This package provides a wrapper that uses the function \texttt{wilcox.test} in \texttt{stats}. <<>>= -result <- inference.wilcox(es.w=es.cs, to.plot=TRUE) -result +result <- inference.wilcox(es.w=es.cs, to.plot=FALSE) +print(result) @ \begin{figure}[t] @@ -312,7 +315,11 @@ \setkeys{Gin}{width=0.8\linewidth} \setkeys{Gin}{height=0.8\linewidth} <>= -result <- inference.wilcox(es.w=es.cs, to.plot=TRUE) +es.na.wcx <- eventstudy(firm.returns = StockPriceReturns, + eventList = SplitDates, width = 10, to.remap = TRUE, + remap = "cumsum", inference = TRUE, + inference.strategy = "wilcox", type = "None") +plot(es.na.wcx) @ \end{center} \label{fig:two} From noreply at r-forge.r-project.org Tue Mar 25 14:44:45 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 25 Mar 2014 14:44:45 +0100 (CET) Subject: [Eventstudies-commits] r220 - pkg/vignettes Message-ID: <20140325134445.C3950185A8B@r-forge.r-project.org> Author: vikram Date: 2014-03-25 14:44:45 +0100 (Tue, 25 Mar 2014) New Revision: 220 Modified: pkg/vignettes/eventstudies.Rnw Log: Minor modification Modified: pkg/vignettes/eventstudies.Rnw =================================================================== --- pkg/vignettes/eventstudies.Rnw 2014-03-25 13:42:41 UTC (rev 219) +++ pkg/vignettes/eventstudies.Rnw 2014-03-25 13:44:45 UTC (rev 220) @@ -294,7 +294,7 @@ eventList = SplitDates, width = 10, to.remap = TRUE, remap = "cumsum", inference = TRUE, inference.strategy = "bootstrap", type = "None") -plot.es(es.na.btsp) +plot(es.na.btsp) @ \end{center} \label{fig:one} From noreply at r-forge.r-project.org Tue Mar 25 16:34:17 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 25 Mar 2014 16:34:17 +0100 (CET) Subject: [Eventstudies-commits] r221 - pkg/R Message-ID: <20140325153417.7DF9E18723B@r-forge.r-project.org> Author: vikram Date: 2014-03-25 16:34:16 +0100 (Tue, 25 Mar 2014) New Revision: 221 Modified: pkg/R/inference.bootstrap.R Log: Minor modification Modified: pkg/R/inference.bootstrap.R =================================================================== --- pkg/R/inference.bootstrap.R 2014-03-25 13:44:45 UTC (rev 220) +++ pkg/R/inference.bootstrap.R 2014-03-25 15:34:16 UTC (rev 221) @@ -30,7 +30,7 @@ } # Plotting inference -plot.es <- function(es.object, xlab="Event time", +plot.inference <- function(inference, xlab="Event time", ylab="", main="", col.es="dark slate blue"){ big <- max(abs(es.object$eventstudy.output)) hilo <- c(-big,big) @@ -103,7 +103,7 @@ colnames(result) <- c("2.5%","Median","97.5%") rownames(result) <- rownames(Median) if(to.plot == TRUE){ - plot.es(inference = result, xlab, ylab, main) + plot.inference(inference = result, xlab, ylab, main) } return(result) } From noreply at r-forge.r-project.org Tue Mar 25 17:02:33 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 25 Mar 2014 17:02:33 +0100 (CET) Subject: [Eventstudies-commits] r222 - in pkg: R man Message-ID: <20140325160233.4007C18727F@r-forge.r-project.org> Author: vikram Date: 2014-03-25 17:02:32 +0100 (Tue, 25 Mar 2014) New Revision: 222 Modified: pkg/R/eventstudy.R pkg/R/inference.bootstrap.R pkg/man/lmAMM.Rd pkg/man/subperiod.lmAMM.Rd Log: Minor edit Modified: pkg/R/eventstudy.R =================================================================== --- pkg/R/eventstudy.R 2014-03-25 15:34:16 UTC (rev 221) +++ pkg/R/eventstudy.R 2014-03-25 16:02:32 UTC (rev 222) @@ -24,7 +24,11 @@ timeseriesAMM <- function(firm.returns,X,verbose=FALSE,nlags=1){ tmp <- resid(lmAMM(firm.returns,X,nlags)) tmp.res <- zoo(tmp,as.Date(names(tmp))) - } + } + ## Estimating AMM regressors + regressors <- makeX(market.returns, others, + market.returns.purge, nlags, + switch.to.innov) if(NCOL(firm.returns)==1){ ## One firm outputModel <- timeseriesAMM(firm.returns=StockPriceReturns[,1], Modified: pkg/R/inference.bootstrap.R =================================================================== --- pkg/R/inference.bootstrap.R 2014-03-25 15:34:16 UTC (rev 221) +++ pkg/R/inference.bootstrap.R 2014-03-25 16:02:32 UTC (rev 222) @@ -32,16 +32,16 @@ # Plotting inference plot.inference <- function(inference, xlab="Event time", ylab="", main="", col.es="dark slate blue"){ - big <- max(abs(es.object$eventstudy.output)) + big <- max(abs(inference$eventstudy.output)) hilo <- c(-big,big) - width <- (nrow(es.object$eventstudy.output)-1)/2 - plot(-width:width, es.object$eventstudy.output[,2], type="l", lwd=2, ylim=hilo, + width <- (nrow(inference$eventstudy.output)-1)/2 + plot(-width:width, inference$eventstudy.output[,2], type="l", lwd=2, ylim=hilo, col=col.es,xlab= xlab, ylab = ylab, main=paste(main)) - points(-width:width, es.object$eventstudy.output[,2]) - lines(-width:width, es.object$eventstudy.output[,"2.5%"], + points(-width:width, inference$eventstudy.output[,2]) + lines(-width:width, inference$eventstudy.output[,"2.5%"], lwd=1, lty=2, col=col.es) - lines(-width:width, es.object$eventstudy.output[,"97.5%"], + lines(-width:width, inference$eventstudy.output[,"97.5%"], lwd=1, lty=2, col=col.es) abline(h=0,v=0) } @@ -68,7 +68,7 @@ rownames(results) <- rownames(es.w) colnames(results) <- c("2.5%","Mean","97.5%") if(to.plot==TRUE){ - plot.es(inference=results, xlab, ylab, main) + plot.inference(inference=results, xlab, ylab, main) } return(results) } Modified: pkg/man/lmAMM.Rd =================================================================== --- pkg/man/lmAMM.Rd 2014-03-25 15:34:16 UTC (rev 221) +++ pkg/man/lmAMM.Rd 2014-03-25 16:02:32 UTC (rev 222) @@ -49,7 +49,7 @@ \author{Ajay Shah, Vimal Balasubramaniam} \seealso{ -\code{\link{manyfirmsAMM}, \link{makeX}} +\code{\link{makeX}} } \examples{ Modified: pkg/man/subperiod.lmAMM.Rd =================================================================== --- pkg/man/subperiod.lmAMM.Rd 2014-03-25 15:34:16 UTC (rev 221) +++ pkg/man/subperiod.lmAMM.Rd 2014-03-25 16:02:32 UTC (rev 222) @@ -48,8 +48,8 @@ \author{Vimal Balasubramaniam} -\seealso{ \code{\link{firmExposures}}, -\code{\link{manyfirmsAMM}}} +\seealso{ \code{\link{lmAMM}}, +\code{\link{manyfirmssubperiod.lmAMM}}} \examples{ data("lmAMMData") From noreply at r-forge.r-project.org Tue Mar 25 17:22:50 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Tue, 25 Mar 2014 17:22:50 +0100 (CET) Subject: [Eventstudies-commits] r223 - pkg/R Message-ID: <20140325162250.4EC75187144@r-forge.r-project.org> Author: vikram Date: 2014-03-25 17:22:50 +0100 (Tue, 25 Mar 2014) New Revision: 223 Modified: pkg/R/eventstudy.R Log: modified eventstudy function type AMM Modified: pkg/R/eventstudy.R =================================================================== --- pkg/R/eventstudy.R 2014-03-25 16:02:32 UTC (rev 222) +++ pkg/R/eventstudy.R 2014-03-25 16:22:50 UTC (rev 223) @@ -9,6 +9,7 @@ inference.strategy = "bootstrap", ...) { # type = "marketResidual", "excessReturn", "AMM", "None" + extra.var <- unlist(...) if (type == "None" && !is.null(firm.returns)) { outputModel <- firm.returns } @@ -16,7 +17,7 @@ if (is.levels == TRUE) { firm.returns <- diff(log(firm.returns)) * 100 } - + ### Run models ## AMM if (type == "AMM") { @@ -26,18 +27,21 @@ tmp.res <- zoo(tmp,as.Date(names(tmp))) } ## Estimating AMM regressors - regressors <- makeX(market.returns, others, - market.returns.purge, nlags, - switch.to.innov) + regressors <- makeX(market.returns=extra.var$market.returns, + others = extra.var$others, + market.returns.purge=extra.var$market.returns.purge, + nlags=extra.var$nlags, + switch.to.innov=extra.var$switch.to.innov) if(NCOL(firm.returns)==1){ ## One firm - outputModel <- timeseriesAMM(firm.returns=StockPriceReturns[,1], - X=regressors, verbose=FALSE, nlags=1) + outputModel <- timeseriesAMM(firm.returns,X=regressors, + verbose=FALSE, nlags=1) + } else { ## More than one firm # Extracting and merging - tmp.resid <- sapply(colnames(StockPriceReturns)[1:3],function(y) - timeseriesAMM(firm.returns=StockPriceReturns[,y], + tmp.resid <- sapply(colnames(firm.returns),function(y) + timeseriesAMM(firm.returns[,y], X=regressors, verbose=FALSE, nlags=1)) From noreply at r-forge.r-project.org Wed Mar 26 09:28:40 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 26 Mar 2014 09:28:40 +0100 (CET) Subject: [Eventstudies-commits] r224 - pkg/R Message-ID: <20140326082840.B812718723D@r-forge.r-project.org> Author: vikram Date: 2014-03-26 09:28:37 +0100 (Wed, 26 Mar 2014) New Revision: 224 Modified: pkg/R/eventstudy.R Log: Modified plot.es function Modified: pkg/R/eventstudy.R =================================================================== --- pkg/R/eventstudy.R 2014-03-25 16:22:50 UTC (rev 223) +++ pkg/R/eventstudy.R 2014-03-26 08:28:37 UTC (rev 224) @@ -129,17 +129,17 @@ } plot.es <- function(x, xlab="Event time", - ylab="", main="", col.es="dark slate blue"){ + ylab="", main="", col="dark slate blue"){ big <- max(abs(x$eventstudy.output)) hilo <- c(-big,big) width <- (nrow(x$eventstudy.output)-1)/2 plot(-width:width, x$eventstudy.output[,2], type="l", lwd=2, ylim=hilo, - col=col.es,xlab= xlab, ylab = ylab, + col=col,xlab= xlab, ylab = ylab, main=paste(main)) points(-width:width, x$eventstudy.output[,2]) lines(-width:width, x$eventstudy.output[,"2.5%"], - lwd=1, lty=2, col=col.es) + lwd=1, lty=2, col=col) lines(-width:width, x$eventstudy.output[,"97.5%"], - lwd=1, lty=2, col=col.es) + lwd=1, lty=2, col=col) abline(h=0,v=0) } From noreply at r-forge.r-project.org Wed Mar 26 18:30:55 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 26 Mar 2014 18:30:55 +0100 (CET) Subject: [Eventstudies-commits] r225 - pkg/man Message-ID: <20140326173055.406FA187178@r-forge.r-project.org> Author: chiraganand Date: 2014-03-26 18:30:54 +0100 (Wed, 26 Mar 2014) New Revision: 225 Modified: pkg/man/eventstudy.Rd Log: Changed AMM type to lmAMM. Modified: pkg/man/eventstudy.Rd =================================================================== --- pkg/man/eventstudy.Rd 2014-03-26 08:28:37 UTC (rev 224) +++ pkg/man/eventstudy.Rd 2014-03-26 17:30:54 UTC (rev 225) @@ -74,7 +74,7 @@ } \details{ - When using \dQuote{AMM} adjustement, the default output is + When using \dQuote{lmAMM} adjustement, the default output is \dQuote{residual}. } From noreply at r-forge.r-project.org Wed Mar 26 18:39:05 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 26 Mar 2014 18:39:05 +0100 (CET) Subject: [Eventstudies-commits] r226 - pkg/R Message-ID: <20140326173906.208ED180AB7@r-forge.r-project.org> Author: chiraganand Date: 2014-03-26 18:39:05 +0100 (Wed, 26 Mar 2014) New Revision: 226 Modified: pkg/R/eventstudy.R Log: Fixed the code to use lmAMM, fixed reading of extra args for the model, changed code formatting. Modified: pkg/R/eventstudy.R =================================================================== --- pkg/R/eventstudy.R 2014-03-26 17:30:54 UTC (rev 225) +++ pkg/R/eventstudy.R 2014-03-26 17:39:05 UTC (rev 226) @@ -9,7 +9,8 @@ inference.strategy = "bootstrap", ...) { # type = "marketResidual", "excessReturn", "AMM", "None" - extra.var <- unlist(...) + extra.var <- list(...) + if (type == "None" && !is.null(firm.returns)) { outputModel <- firm.returns } @@ -20,34 +21,40 @@ ### Run models ## AMM - if (type == "AMM") { + if (type == "lmAMM") { ## AMM residual to time series - timeseriesAMM <- function(firm.returns,X,verbose=FALSE,nlags=1){ - tmp <- resid(lmAMM(firm.returns,X,nlags)) - tmp.res <- zoo(tmp,as.Date(names(tmp))) + timeseriesAMM <- function(firm.returns, X, verbose = FALSE, nlags = 1) { + tmp <- resid(lmAMM(firm.returns = firm.returns, + X = X, + nlags = nlags, + verbose = FALSE)) + tmp.res <- zoo(x = tmp, order.by = as.Date(names(tmp))) } ## Estimating AMM regressors - regressors <- makeX(market.returns=extra.var$market.returns, - others = extra.var$others, - market.returns.purge=extra.var$market.returns.purge, - nlags=extra.var$nlags, - switch.to.innov=extra.var$switch.to.innov) + regressors <- makeX(market.returns = extra.var$market.returns, + others = extra.var$others, + switch.to.innov = extra.var$switch.to.innov, + market.returns.purge = extra.var$market.returns.purge, + nlags = extra.var$nlags) if(NCOL(firm.returns)==1){ ## One firm - outputModel <- timeseriesAMM(firm.returns,X=regressors, - verbose=FALSE, nlags=1) - + outputModel <- timeseriesAMM(firm.returns = firm.returns, + X = regressors, + verbose = FALSE, + nlags = 1) } else { ## More than one firm # Extracting and merging - tmp.resid <- sapply(colnames(firm.returns),function(y) - timeseriesAMM(firm.returns[,y], - X=regressors, - verbose=FALSE, - nlags=1)) + tmp.resid <- sapply(colnames(firm.returns), function(y) + { + timeseriesAMM(firm.returns = firm.returns[,y], + X = regressors, + verbose = FALSE, + nlags = 1) + }) outputModel <- do.call("merge",tmp.resid) - } - } + } + } ## end AMM ## marketResidual if (type == "marketResidual") { From noreply at r-forge.r-project.org Wed Mar 26 19:24:05 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Wed, 26 Mar 2014 19:24:05 +0100 (CET) Subject: [Eventstudies-commits] r227 - in pkg: R vignettes Message-ID: <20140326182405.43D461868C8@r-forge.r-project.org> Author: vikram Date: 2014-03-26 19:24:04 +0100 (Wed, 26 Mar 2014) New Revision: 227 Modified: pkg/R/eventstudy.R pkg/vignettes/eventstudies.Rnw Log: minor change in vignette Modified: pkg/R/eventstudy.R =================================================================== --- pkg/R/eventstudy.R 2014-03-26 17:39:05 UTC (rev 226) +++ pkg/R/eventstudy.R 2014-03-26 18:24:04 UTC (rev 227) @@ -135,18 +135,15 @@ object$outcomes } -plot.es <- function(x, xlab="Event time", - ylab="", main="", col="dark slate blue"){ +plot.es <- function(x, ...){ big <- max(abs(x$eventstudy.output)) hilo <- c(-big,big) width <- (nrow(x$eventstudy.output)-1)/2 - plot(-width:width, x$eventstudy.output[,2], type="l", lwd=2, ylim=hilo, - col=col,xlab= xlab, ylab = ylab, - main=paste(main)) + plot(-width:width, x$eventstudy.output[,2], type="l", lwd=2, ylim=hilo, ...) points(-width:width, x$eventstudy.output[,2]) lines(-width:width, x$eventstudy.output[,"2.5%"], - lwd=1, lty=2, col=col) + lwd=1, lty=2, ...) lines(-width:width, x$eventstudy.output[,"97.5%"], - lwd=1, lty=2, col=col) + lwd=1, lty=2, ...) abline(h=0,v=0) } Modified: pkg/vignettes/eventstudies.Rnw =================================================================== --- pkg/vignettes/eventstudies.Rnw 2014-03-26 17:39:05 UTC (rev 226) +++ pkg/vignettes/eventstudies.Rnw 2014-03-26 18:24:04 UTC (rev 227) @@ -246,14 +246,14 @@ \subsection{Conversion to event-time frame} -The conversion from physical time into event time combines the two objects we have constructed till now: \textit{SplitDates} and \textit{StockPriceReturns}. These two objects are input matrices for the function \texttt{phys2eventtime}. With the specification of ``width=10'' in the function, we require phys2eventtime to define a successfull unit entry (an event) in the result as one where there is no missing data for 10 days before and after the event. This is marked as ``success'' in the resulting list object. With data missing, the unit is flagged ``wdatamissing''. In case the event falls outside of the range of physical time provided in the input data, the unit entry will be flagged ``wrongspan'' and if the unit in \textit{SplitDates} is missing in \textit{StockPriceReturns}, we identify these entries as ``unitmissing''. This allows the user to identify successful entries in the sample for an analysis based on event time. In this example, we make use of successful entries in the data and the output object is stored as \textit{es.w}: +The conversion from physical time into event time combines the two objects we have constructed till now: \textit{SplitDates} and \textit{StockPriceReturns}. These two objects are input matrices for the function \texttt{phys2eventtime}. With the specification of ``width=5'' in the function, we require phys2eventtime to define a successfull unit entry (an event) in the result as one where there is no missing data for 5 days before and after the event. This is marked as ``success'' in the resulting list object. With data missing, the unit is flagged ``wdatamissing''. In case the event falls outside of the range of physical time provided in the input data, the unit entry will be flagged ``wrongspan'' and if the unit in \textit{SplitDates} is missing in \textit{StockPriceReturns}, we identify these entries as ``unitmissing''. This allows the user to identify successful entries in the sample for an analysis based on event time. In this example, we make use of successful entries in the data and the output object is stored as \textit{es.w}: <<>>= es <- phys2eventtime(z=StockPriceReturns, events=SplitDates, - width=10) + width=5) str(es) es$outcomes -es.w <- window(es$z.e, start=-10,end=10) +es.w <- window(es$z.e, start=-5,end=5) colnames(es.w) <- SplitDates[which(es$outcomes=="success"),1] SplitDates[1,] StockPriceReturns[SplitDates[1,2],SplitDates[1,1]] @@ -353,7 +353,7 @@ es.amm <- eventstudy(firm.returns = StockPriceReturns, eventList = SplitDates, width = 10, to.remap = TRUE, remap = "cumsum", inference = TRUE, inference.strategy = "bootstrap", - type = "AMM", market.returns = nifty.index, + type = "lmAMM", market.returns = nifty.index, others=inrusd, verbose=FALSE, switch.to.innov=TRUE, market.returns.purge=TRUE, nlags=1) print(es.na) From noreply at r-forge.r-project.org Thu Mar 27 00:48:24 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 27 Mar 2014 00:48:24 +0100 (CET) Subject: [Eventstudies-commits] r228 - pkg/inst/tests Message-ID: <20140326234824.EED20186DA8@r-forge.r-project.org> Author: chiraganand Date: 2014-03-27 00:48:24 +0100 (Thu, 27 Mar 2014) New Revision: 228 Added: pkg/inst/tests/test_firmExposuresData.rda pkg/inst/tests/test_y3c3.rda Modified: pkg/inst/tests/test_lmAMM.R Log: Added old test data sets, reverted AMM tests to revision r124 of test_AMM.R, the file was removed in r171. These tests are passing. Added: pkg/inst/tests/test_firmExposuresData.rda =================================================================== (Binary files differ) Property changes on: pkg/inst/tests/test_firmExposuresData.rda ___________________________________________________________________ Added: svn:mime-type + application/x-gzip Modified: pkg/inst/tests/test_lmAMM.R =================================================================== --- pkg/inst/tests/test_lmAMM.R 2014-03-26 18:24:04 UTC (rev 227) +++ pkg/inst/tests/test_lmAMM.R 2014-03-26 23:48:24 UTC (rev 228) @@ -1,74 +1,67 @@ -context("AMM") +context("lmAMM") -test_that("test.AMM", { - load(system.file("data", "lmAMMData.rda", package = "eventstudies")) +test_that("test.lmAMM", { + load("test_firmExposuresData.rda") - firm.returns <- lmAMMData$Infosys - market.returns <- lmAMMData$index.nifty - inrusd <- lmAMMData$currency.inrusd - rM3 <- lmAMMData$call.money.rate + firm.returns <- firmExposuresData$Company_A + market.returns <- firmExposuresData$NIFTY_INDEX + inrusd <- firmExposuresData$usdinr + rM3 <- firmExposuresData$baa - cat("\nDoing Testcase P2\n") + cat("\nDoing Testcase P2") X <- makeX(market.returns, others=inrusd, switch.to.innov=FALSE, market.returns.purge=FALSE, verbose=FALSE) a <- lmAMM(firm.returns, X, nlags=0, verbose=FALSE) expect_that(c(a$exposures, a$s.exposures), - equals(structure(c(0.7064442,0.3585404, - 0.0966792,0.1062146), - .Names = c("market.returns", "z", - "market.returns", "z")), tolerance=1e-1)) + equals(structure(c(0.716160223601197,-0.673093436292401, + 0.152101606133946,1.02143820457251), + .Names = c("market.returns", "z", "market.returns", "z")), tolerance=1e-1)) - cat("\nDoing Testcase P3\n") + cat("\nDoing Testcase P3") X <- makeX(market.returns, others=inrusd, switch.to.innov=TRUE, market.returns.purge=FALSE, verbose=FALSE) a <- lmAMM(firm.returns, X, nlags=0, verbose=FALSE) expect_that(c(a$exposures, a$s.exposures), - equals(structure(c(0.67706599, 0.27939607, - 0.09719514, 0.10192811), - .Names = c("market.returns", "z", - "market.returns", "z")), tolerance=1e-1)) + equals(structure(c(0.716160223601197,-0.673093436292401, + 0.152100337597009,1.02146106755333), + .Names = c("market.returns", "z", "market.returns", "z")), tolerance=1e-1)) - cat("\nDoing Testcase P4\n") + cat("\nDoing Testcase P4") a <- lmAMM(firm.returns, X, nlags=1, verbose=FALSE) expect_that(c(a$exposures, a$s.exposures), - equals(structure(c(0.68343189, 0.61069556, - 0.09794233, 0.12353826), - .Names = c("market.returns","z", - "market.returns", "z")),tolerance=1e-1)) + equals(structure(c( 0.736264286484902, -1.450805, + 0.177929844631439, 1.646730), + .Names = c("market.returns","z", "market.returns", "z")),tolerance=1e-1)) - cat("\nDoing Testcase P5\n") + cat("\nDoing Testcase P5") X <- makeX(market.returns, others=inrusd, switch.to.innov=TRUE, market.returns.purge=TRUE, nlags=1, verbose=FALSE) a <- lmAMM(firm.returns, X, nlags=1, verbose=FALSE) expect_that(c(a$exposures, a$s.exposures), - equals(structure(c(0.68343189, 0.06813816, - 0.09844400, 0.11950216), - .Names = c("market.returns", "z", - "market.returns", "z")),tolerance=1e-1)) + equals(structure(c(0.7365566,-2.340171, + 0.1653025, 1.1436666), + .Names = c("market.returns", "z", "market.returns", "z")),tolerance=1e-1)) - cat("\nDoing Testcase P6\n") + cat("\nDoing Testcase P6") X <- makeX(market.returns, others=cbind(inrusd, rM3), switch.to.innov=c(FALSE, FALSE), market.returns.purge=FALSE, verbose=FALSE) a <- lmAMM(firm.returns, X, nlags=0, verbose=FALSE) expect_that(c(a$exposures, a$s.exposures), - equals(structure(c(0.70726513, 0.35942623, -77.52744495, - 0.09602279, 0.10668916, 259.10845540), - .Names = c("market.returns", "inrusd", "rM3", - "market.returns", "inrusd", "rM3")), - tolerance=1e-1)) + equals(structure(c(0.7230599,-0.7642377, + 0.207374104922771,0.173380799334299, + 1.01806122963342,0.467821650129292), + .Names = c("market.returns", "inrusd", "rM3", "market.returns", "inrusd", "rM3")),tolerance=1e-1)) - cat("\nDoing Testcase P7\n") + cat("\nDoing Testcase P7") X <- makeX(market.returns, others=cbind(inrusd, rM3), switch.to.innov=c(TRUE, TRUE), market.returns.purge=TRUE, nlags=1, verbose=FALSE) a <- lmAMM(firm.returns, X, nlags=1, verbose=FALSE) expect_that(c(a$exposures, a$s.exposures), - equals(structure(c(6.922458e-01, 6.542345e-02, 1.169788e+03, - 1.038158e-01, 1.214853e-01, 5.786265e+02), - .Names = c("market.returns", "inrusd", "rM3", - "market.returns", "inrusd", "rM3")), - tolerance=1e-1)) + equals(structure(c(0.7482719,-1.9468851,-0.4802211, + 0.1740678,1.2455112,0.6146619), + .Names = c("market.returns", "inrusd", "rM3", "market.returns", "inrusd", "rM3")),tolerance=1e-1)) ################################################################################ # # @@ -77,42 +70,57 @@ ################################################################################ - cat("\nDoing Testcases P8\n") - load(system.file("data", "lmAMMData.rda", package = "eventstudies")) + cat("\nDoing Testcases P8") + load("test_y3c3.rda") - nifty <- lmAMMData$index.nifty - inrusd <- lmAMMData$currency.inrusd - infosys <- lmAMMData$Infosys - tcs <- lmAMMData$TCS - - regressors <- makeX(nifty, others=inrusd, + NIFTY_INDEX <- y3c3$NIFTY_INDEX + INRUSD <- y3c3$INRUSD + Company_A <- y3c3$Company_A + Company_B <- y3c3$Company_B + Company_C <- y3c3$Company_C + + regressors <- makeX(NIFTY_INDEX, others=INRUSD, switch.to.innov=TRUE, market.returns.purge=TRUE, nlags=1, - dates=as.Date(c("2012-02-01","2013-01-01","2014-01-20")), - verbose=FALSE) + dates=as.Date(c("2005-01-15","2006-01-07","2007-01-06", + "2008-01-05","2009-01-03")), verbose=FALSE) - regressand <- cbind(infosys,tcs) + regressand <- cbind(Company_A,Company_B,Company_C) res <- manyfirmssubperiod.lmAMM(regressand,regressors,lags=1, - dates=as.Date(c("2012-02-01","2013-01-01","2014-01-20")), - periodnames=c("P1","P2"), - verbose=FALSE) + 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"), + verbose=FALSE) - match.res <- structure(list(exposures.market.returns.P1=c(0.8446433,0.6875982), - exposures.z.P1 = c(-0.05351359,0.36151838), - exposures.market.returns.P2=c(0.5865497,0.5822848), - exposures.z.P2 = c(0.1375913,-0.0993528), - - sds.market.returns.P1=c(0.1267067,0.1298345), - sds.z.P1 = c(0.1810424, 0.2865279), - sds.market.returns.P2=c(0.1353948,0.1111106), - sds.z.P2 = c(0.1644340,0.2235453), + expect_that(as.data.frame(res), - sig.market.returns.P1=c(6.666130,5.295958), - sig.z.P1 = c(-0.295586,1.261721), - sig.market.returns.P2=c(4.332144,5.240588), - sig.z.P2 = c(0.8367568,-0.4444415)), - row.names=c("infosys","tcs"),class="data.frame") - - expect_that(as.data.frame(res), - equals(match.res,check.attributes=FALSE,tolerance=1e-1)) + equals(structure(list(market.returns.P1 = c(0.756294904326272, 0.359467326140834,0.914021428042946), + z.P1 = c(-2.23264294525560, -1.05654919420689,0.296635483126946), + market.returns.P2 = c(1.02094561445355, 0.988758963378838,0.879236409569888), + z.P2 = c(-4.72831391695047, -2.0508684999854,-1.02215809586573), + market.returns.P3 = c(1.20585808099744, 0.676388278572118,0.530718379431386), + z.P3 = c(-1.32677083522489, -2.74055730512260, -1.50032216697694), + market.returns.P4 = c(1.11331096371784, 0.437117737120777,0.663182186702262), + z.P4 = c(-2.05336868436562, -1.60350865767951,-0.466253391408585), + market.returns.P1 = c(0.143617135793294, 0.263130891045529,0.154272220123111), + z.P1 = c(1.20226371286803, 1.22122136357895,1.02442932195400), + market.returns.P2 = c(0.203037609116444, 0.123122376136099,0.121880488983820), + z.P2 = c(1.118400430819, 0.798694545623495,1.29755067543957), + market.returns.P3 = c(0.230304109532112, 0.289262660515515,0.164866239494693), + z.P3 = c(1.17618117392934, 0.795008683829453,0.650736332270758), + market.returns.P4 = c(0.231338818884745, 0.213858364836974,0.207154237634752), + z.P4 = c(0.771450066857429, 0.415931231130697,0.696448914066602), + market.returns.P1 = c(5.26604920888266, 1.36611602200152,5.9247311493511), + z.P1 = c(-1.85703263049467, -0.865157804896683,0.289561687438957), + market.returns.P2 = c(5.02835715460001, 8.0307007906172,7.21392256382075), + z.P2 = c(-4.2277468665565, -2.56777576762391,-0.787759673062059), + market.returns.P3 = c(5.23593818385294, 2.33831866638673,3.21908464133114), + z.P3 = c(-1.12803270842405, -3.44720423923131,-2.30557614900882), + market.returns.P4 = c(4.81246929972659, 2.04395903547657,3.20139329165723), + z.P4 = c(-2.66170005367969, -3.85522542589652,-0.669472493949494)), + .Names = c("market.returns.P1", "z.P1", "market.returns.P2","z.P2", "market.returns.P3", "z.P3", + "market.returns.P4", "z.P4", "market.returns.P1", "z.P1","market.returns.P2", "z.P2", "market.returns.P3", "z.P3", + "market.returns.P4", "z.P4", "market.returns.P1", "z.P1", "market.returns.P2", "z.P2", "market.returns.P3", + "z.P3", "market.returns.P4", "z.P4"), + row.names = c("Company_A","Company_B", "Company_C"), class = "data.frame"), + check.attributes=FALSE)) }) Added: pkg/inst/tests/test_y3c3.rda =================================================================== (Binary files differ) Property changes on: pkg/inst/tests/test_y3c3.rda ___________________________________________________________________ Added: svn:mime-type + application/x-gzip From noreply at r-forge.r-project.org Thu Mar 27 17:05:01 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 27 Mar 2014 17:05:01 +0100 (CET) Subject: [Eventstudies-commits] r229 - pkg/vignettes Message-ID: <20140327160501.AA22B18729A@r-forge.r-project.org> Author: vikram Date: 2014-03-27 17:05:01 +0100 (Thu, 27 Mar 2014) New Revision: 229 Modified: pkg/vignettes/ees.Rnw Log: Minor edit in vignette; check running properly Modified: pkg/vignettes/ees.Rnw =================================================================== --- pkg/vignettes/ees.Rnw 2014-03-26 23:48:24 UTC (rev 228) +++ pkg/vignettes/ees.Rnw 2014-03-27 16:05:01 UTC (rev 229) @@ -11,7 +11,8 @@ \author{Vikram Bahure \and Vimal Balasubramaniam \and Ajay Shah} \begin{document} % \VignetteIndexEntry{eventstudies: Extreme events functionality} -% \VignetteDepends{} \VignetteKeywords{extreme event analysis} +% \VignetteDepends{} +% \VignetteKeywords{extreme event analysis} % \VignettePackage{eventstudies} \maketitle From noreply at r-forge.r-project.org Thu Mar 27 17:52:09 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 27 Mar 2014 17:52:09 +0100 (CET) Subject: [Eventstudies-commits] r230 - pkg/R Message-ID: <20140327165209.2C9FF186C33@r-forge.r-project.org> Author: chiraganand Date: 2014-03-27 17:52:08 +0100 (Thu, 27 Mar 2014) New Revision: 230 Modified: pkg/R/lmAmm.R Log: Removed usage of doMC, isn't needed. Modified: pkg/R/lmAmm.R =================================================================== --- pkg/R/lmAmm.R 2014-03-27 16:05:01 UTC (rev 229) +++ pkg/R/lmAmm.R 2014-03-27 16:52:08 UTC (rev 230) @@ -67,8 +67,6 @@ manyfirmssubperiod.lmAMM <- function(firm.returns,X, lags,dates=NULL, periodnames=NULL,verbose=FALSE){ - require("doMC") - registerDoMC() if(is.null(dates)){ dates=c(start(X),end(X)) periodnames="Full" From noreply at r-forge.r-project.org Thu Mar 27 17:53:24 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 27 Mar 2014 17:53:24 +0100 (CET) Subject: [Eventstudies-commits] r231 - pkg Message-ID: <20140327165324.A2545186CF5@r-forge.r-project.org> Author: chiraganand Date: 2014-03-27 17:53:24 +0100 (Thu, 27 Mar 2014) New Revision: 231 Modified: pkg/DESCRIPTION Log: Removed unneeded dependencies. Modified: pkg/DESCRIPTION =================================================================== --- pkg/DESCRIPTION 2014-03-27 16:52:08 UTC (rev 230) +++ pkg/DESCRIPTION 2014-03-27 16:53:24 UTC (rev 231) @@ -4,7 +4,7 @@ Version: 1.1 Author: Ajay Shah, Chirag Anand, Vikram Bahure Maintainer: Vikram Bahure -Depends: R (>= 2.12.0), zoo, xts, boot, testthat, sandwich, doMC, foreach +Depends: R (>= 2.12.0), zoo, xts, boot, testthat, sandwich Description: Event study methodology in finance and economics; along with augmented market models (AMMs) License: GPL-2 LazyLoad: yes From noreply at r-forge.r-project.org Thu Mar 27 18:17:53 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 27 Mar 2014 18:17:53 +0100 (CET) Subject: [Eventstudies-commits] r232 - pkg Message-ID: <20140327171753.A5D08187182@r-forge.r-project.org> Author: chiraganand Date: 2014-03-27 18:17:53 +0100 (Thu, 27 Mar 2014) New Revision: 232 Modified: pkg/DESCRIPTION Log: Rearranged authors alphabetically. Modified: pkg/DESCRIPTION =================================================================== --- pkg/DESCRIPTION 2014-03-27 16:53:24 UTC (rev 231) +++ pkg/DESCRIPTION 2014-03-27 17:17:53 UTC (rev 232) @@ -2,7 +2,7 @@ Type: Package Title: Event study analysis Version: 1.1 -Author: Ajay Shah, Chirag Anand, Vikram Bahure +Author: Chirag Anand, Vikram Bahure, Vimal Balasubramaniam, Ajay Shah, Maintainer: Vikram Bahure Depends: R (>= 2.12.0), zoo, xts, boot, testthat, sandwich Description: Event study methodology in finance and economics; along with augmented market models (AMMs) From noreply at r-forge.r-project.org Thu Mar 27 18:20:26 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 27 Mar 2014 18:20:26 +0100 (CET) Subject: [Eventstudies-commits] r233 - pkg Message-ID: <20140327172026.7071018726A@r-forge.r-project.org> Author: chiraganand Date: 2014-03-27 18:20:26 +0100 (Thu, 27 Mar 2014) New Revision: 233 Modified: pkg/DESCRIPTION Log: Changed description of the package. Modified: pkg/DESCRIPTION =================================================================== --- pkg/DESCRIPTION 2014-03-27 17:17:53 UTC (rev 232) +++ pkg/DESCRIPTION 2014-03-27 17:20:26 UTC (rev 233) @@ -5,6 +5,6 @@ Author: Chirag Anand, Vikram Bahure, Vimal Balasubramaniam, Ajay Shah, Maintainer: Vikram Bahure Depends: R (>= 2.12.0), zoo, xts, boot, testthat, sandwich -Description: Event study methodology in finance and economics; along with augmented market models (AMMs) +Description: An R package for researchers and users of event studies. License: GPL-2 LazyLoad: yes From noreply at r-forge.r-project.org Thu Mar 27 18:24:33 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 27 Mar 2014 18:24:33 +0100 (CET) Subject: [Eventstudies-commits] r234 - pkg Message-ID: <20140327172433.E7EF01872B5@r-forge.r-project.org> Author: chiraganand Date: 2014-03-27 18:24:33 +0100 (Thu, 27 Mar 2014) New Revision: 234 Modified: pkg/DESCRIPTION Log: Changed package description. Modified: pkg/DESCRIPTION =================================================================== --- pkg/DESCRIPTION 2014-03-27 17:20:26 UTC (rev 233) +++ pkg/DESCRIPTION 2014-03-27 17:24:33 UTC (rev 234) @@ -5,6 +5,6 @@ Author: Chirag Anand, Vikram Bahure, Vimal Balasubramaniam, Ajay Shah, Maintainer: Vikram Bahure Depends: R (>= 2.12.0), zoo, xts, boot, testthat, sandwich -Description: An R package for researchers and users of event studies. +Description: An R package for conducting event studies and a platform for methodological research on event studies. License: GPL-2 LazyLoad: yes From noreply at r-forge.r-project.org Thu Mar 27 18:24:51 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 27 Mar 2014 18:24:51 +0100 (CET) Subject: [Eventstudies-commits] r235 - pkg Message-ID: <20140327172452.028511872B7@r-forge.r-project.org> Author: chiraganand Date: 2014-03-27 18:24:51 +0100 (Thu, 27 Mar 2014) New Revision: 235 Modified: pkg/DESCRIPTION Log: Removed extra comma. Modified: pkg/DESCRIPTION =================================================================== --- pkg/DESCRIPTION 2014-03-27 17:24:33 UTC (rev 234) +++ pkg/DESCRIPTION 2014-03-27 17:24:51 UTC (rev 235) @@ -2,7 +2,7 @@ Type: Package Title: Event study analysis Version: 1.1 -Author: Chirag Anand, Vikram Bahure, Vimal Balasubramaniam, Ajay Shah, +Author: Chirag Anand, Vikram Bahure, Vimal Balasubramaniam, Ajay Shah Maintainer: Vikram Bahure Depends: R (>= 2.12.0), zoo, xts, boot, testthat, sandwich Description: An R package for conducting event studies and a platform for methodological research on event studies. From noreply at r-forge.r-project.org Thu Mar 27 18:42:10 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 27 Mar 2014 18:42:10 +0100 (CET) Subject: [Eventstudies-commits] r236 - pkg/man Message-ID: <20140327174210.22157184246@r-forge.r-project.org> Author: vikram Date: 2014-03-27 18:42:09 +0100 (Thu, 27 Mar 2014) New Revision: 236 Modified: pkg/man/eventstudy.Rd Log: Modified details for eventstudy function Modified: pkg/man/eventstudy.Rd =================================================================== --- pkg/man/eventstudy.Rd 2014-03-27 17:24:51 UTC (rev 235) +++ pkg/man/eventstudy.Rd 2014-03-27 17:42:09 UTC (rev 236) @@ -3,7 +3,7 @@ \title{Event study analysis} -\description{Function to perform event study analysis and compute confidence intervals} +\description{This function performs event study analysis and further computes confidence interval} \usage{ eventstudy(firm.returns = NULL, @@ -73,9 +73,8 @@ } } -\details{ - When using \dQuote{lmAMM} adjustement, the default output is - \dQuote{residual}. +\details{This function performs event study analysis using basic functions from the package. +The function needs firm returns as input and provides argument \sQuote{type} to generate abnormal returns, if required. If \sQuote{type} is \sQuote{market.residuals} then it will generate abnormal returns using a market model. It also provides option to estimate returns using augmented market model (AMM) which purges out market returns and \sQuote{others} i.e. currency in our case (\sQuote{type} as \sQuote{lmAMM}). The function computes confidence interval using either bootstrap or wilcoxon technique. The output of this function has class \sQuote{es}. } \value{ @@ -83,8 +82,7 @@ following elements: \item{eventstudy.output}{ - a \sQuote{matrix} containing mean/median estimate with confidence - interval. + a object with inference and confidence interval outcome } \item{outcomes}{a character vector having outcome of each event date:} From noreply at r-forge.r-project.org Thu Mar 27 18:43:04 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 27 Mar 2014 18:43:04 +0100 (CET) Subject: [Eventstudies-commits] r237 - pkg/man Message-ID: <20140327174304.E246718430E@r-forge.r-project.org> Author: vikram Date: 2014-03-27 18:43:04 +0100 (Thu, 27 Mar 2014) New Revision: 237 Modified: pkg/man/eventstudy.Rd Log: Minor edit Modified: pkg/man/eventstudy.Rd =================================================================== --- pkg/man/eventstudy.Rd 2014-03-27 17:42:09 UTC (rev 236) +++ pkg/man/eventstudy.Rd 2014-03-27 17:43:04 UTC (rev 237) @@ -82,7 +82,8 @@ following elements: \item{eventstudy.output}{ - a object with inference and confidence interval outcome + a \sQuote{matrix} containing mean/median estimate with confidence +- interval } \item{outcomes}{a character vector having outcome of each event date:} From noreply at r-forge.r-project.org Thu Mar 27 18:49:01 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 27 Mar 2014 18:49:01 +0100 (CET) Subject: [Eventstudies-commits] r238 - pkg/man Message-ID: <20140327174902.0ACA4186A2A@r-forge.r-project.org> Author: chiraganand Date: 2014-03-27 18:49:01 +0100 (Thu, 27 Mar 2014) New Revision: 238 Modified: pkg/man/lmAMM.Rd Log: Modified the value section, included more detail on the AMM class and functions. Modified: pkg/man/lmAMM.Rd =================================================================== --- pkg/man/lmAMM.Rd 2014-03-27 17:43:04 UTC (rev 237) +++ pkg/man/lmAMM.Rd 2014-03-27 17:49:01 UTC (rev 238) @@ -32,10 +32,17 @@ running. Default is \sQuote{FALSE}.} } -\value{The function returns a \sQuote{list} containing exposures, HAC - adjusted standard errors, number of lags used, and residuals from the - fitted model. +\value{The function returns an object of \sQuote{class} \dQuote{amm}. + The functions \sQuote{summary} and \sQuote{print} are provided to + print a summary of results and print the command, coefficients, and + exposures of the analysis. The function \sQuote{plot} is provided to + plot the model residuals and firm returns on the same graph. + + An object of class \dQuote{amm} is a \sQuote{list} containing + the result of \code{stats::lm} function along with the following + components: + \item{exposures}{a \sQuote{numeric} containing exposure estimates for the firm j.} @@ -49,11 +56,11 @@ \author{Ajay Shah, Vimal Balasubramaniam} \seealso{ -\code{\link{makeX}} + \code{\link{makeX}} for preparing explanatory variables for + computation of Augmented Market Models used in this function. } \examples{ -# lmAMM data("lmAMMData") firm.returns <- lmAMMData[,"Infosys"] From noreply at r-forge.r-project.org Thu Mar 27 19:04:44 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Thu, 27 Mar 2014 19:04:44 +0100 (CET) Subject: [Eventstudies-commits] r239 - pkg/man Message-ID: <20140327180445.20059186FE0@r-forge.r-project.org> Author: vikram Date: 2014-03-27 19:04:44 +0100 (Thu, 27 Mar 2014) New Revision: 239 Modified: pkg/man/lmAMM.Rd Log: Minor edit Modified: pkg/man/lmAMM.Rd =================================================================== --- pkg/man/lmAMM.Rd 2014-03-27 17:49:01 UTC (rev 238) +++ pkg/man/lmAMM.Rd 2014-03-27 18:04:44 UTC (rev 239) @@ -5,7 +5,7 @@ \description{This function relates firm returns to the regressors using the linear model (market index movements, currency fluctuations etc.). - It computes firm exposure for all the regressors in columns of X and + It computes firm exposure for all the regressors in columns of \sQuote{X} and subsequently estimates AMM residuals by purging out variation from the regressand.} @@ -19,7 +19,7 @@ AMM estimation.} \item{X}{a time series of explanatory variables obtained from the - makeX function. The first variable is always the stock market + \sQuote{makeX} function. The first variable is always the stock market index. Other variables could be such as currency or bond returns, or other variables as desired by the user.} From noreply at r-forge.r-project.org Fri Mar 28 08:09:36 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 28 Mar 2014 08:09:36 +0100 (CET) Subject: [Eventstudies-commits] r240 - pkg/man Message-ID: <20140328070936.4AF70183FA3@r-forge.r-project.org> Author: chiraganand Date: 2014-03-28 08:09:35 +0100 (Fri, 28 Mar 2014) New Revision: 240 Modified: pkg/man/lmAMM.Rd Log: Changed description, added more details on package functioning. Modified: pkg/man/lmAMM.Rd =================================================================== --- pkg/man/lmAMM.Rd 2014-03-27 18:04:44 UTC (rev 239) +++ pkg/man/lmAMM.Rd 2014-03-28 07:09:35 UTC (rev 240) @@ -3,11 +3,10 @@ \title{Augmented market model (AMM) estimation} -\description{This function relates firm returns to the regressors using - the linear model (market index movements, currency fluctuations etc.). - It computes firm exposure for all the regressors in columns of \sQuote{X} and - subsequently estimates AMM residuals by purging out variation from - the regressand.} +\description{\sQuote{lmAMM} is used to estimate augmented market + model. It can be used to estimate AMM and calculate augmented market + model residuals (AMM abnormal returns) stripped of market and macro + variations.} \usage{ lmAMM(firm.returns, X, nlags = NA, verbose = FALSE) @@ -19,25 +18,39 @@ AMM estimation.} \item{X}{a time series of explanatory variables obtained from the - \sQuote{makeX} function. The first variable is always the stock market - index. Other variables could be such as currency or bond returns, or - other variables as desired by the user.} + \sQuote{makeX} function. See \sQuote{Details}.} \item{nlags}{an \sQuote{integer} with the number of lags of - explanatory variables. When unspecified, the best lag using the AIC - is used.} + explanatory variables.} - \item{verbose}{a \sQuote{logical}. Print function details. When set to - \sQuote{TRUE}, the function prints detailed results while - running. Default is \sQuote{FALSE}.} } + \item{verbose}{\sQuote{logical}. Print function details. If + \sQuote{TRUE}, print detailed results while running. Default is + \sQuote{FALSE}.} +} +\details{ + The function relates firm returns to the regressors (market + index movements, currency fluctuations etc.) using the linear model + \sQuote{lm}. It computes firm exposure for all the regressors in + columns of \dQuote{X} and subsequently estimates AMM residuals by + purging out variation from the regressand. + + The first variable of \dQuote{X} is always the stock market + index. Other variables could be currency or bond returns, or other + variables as desired by the user. + + If \dQuote{nlags} is \sQuote{NA} (default), then the function tries to + find the best lag structure using the AIC. +} + \value{The function returns an object of \sQuote{class} \dQuote{amm}. The functions \sQuote{summary} and \sQuote{print} are provided to - print a summary of results and print the command, coefficients, and - exposures of the analysis. The function \sQuote{plot} is provided to - plot the model residuals and firm returns on the same graph. + print a summary of results and print the \sQuote{lm} command, + coefficients, and exposures of the analysis. The function + \sQuote{plot} is provided to plot the model residuals and firm + returns. An object of class \dQuote{amm} is a \sQuote{list} containing the result of \code{stats::lm} function along with the following From noreply at r-forge.r-project.org Fri Mar 28 08:14:13 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 28 Mar 2014 08:14:13 +0100 (CET) Subject: [Eventstudies-commits] r241 - pkg/man Message-ID: <20140328071413.CC929186A6F@r-forge.r-project.org> Author: chiraganand Date: 2014-03-28 08:14:13 +0100 (Fri, 28 Mar 2014) New Revision: 241 Modified: pkg/man/lmAMM.Rd Log: Added detail on call to 'lm'. Modified: pkg/man/lmAMM.Rd =================================================================== --- pkg/man/lmAMM.Rd 2014-03-28 07:09:35 UTC (rev 240) +++ pkg/man/lmAMM.Rd 2014-03-28 07:14:13 UTC (rev 241) @@ -42,6 +42,10 @@ If \dQuote{nlags} is \sQuote{NA} (default), then the function tries to find the best lag structure using the AIC. + + \sQuote{lmAMM} calls the \code{stats::lm} to do the + OLS. \sQuote{print} function on an object of \sQuote{class} + \dQuote{amm} can be used to see the call (formula) to \code{lm}. } \value{The function returns an object of \sQuote{class} \dQuote{amm}. From noreply at r-forge.r-project.org Fri Mar 28 09:38:08 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 28 Mar 2014 09:38:08 +0100 (CET) Subject: [Eventstudies-commits] r242 - pkg/man Message-ID: <20140328083808.939A9187415@r-forge.r-project.org> Author: chiraganand Date: 2014-03-28 09:38:06 +0100 (Fri, 28 Mar 2014) New Revision: 242 Modified: pkg/man/lmAMM.Rd Log: Added detail on how to prepare explanatory variables for AMM estimation. Modified: pkg/man/lmAMM.Rd =================================================================== --- pkg/man/lmAMM.Rd 2014-03-28 07:14:13 UTC (rev 241) +++ pkg/man/lmAMM.Rd 2014-03-28 08:38:06 UTC (rev 242) @@ -36,9 +36,10 @@ columns of \dQuote{X} and subsequently estimates AMM residuals by purging out variation from the regressand. - The first variable of \dQuote{X} is always the stock market - index. Other variables could be currency or bond returns, or other - variables as desired by the user. + Function \sQuote{makeX} is used to prepare the explanatory variables + (\dQuote{X}) used in the estimation of AMM. The first variable of + \dQuote{X} is always the stock market index. Other variables could be + currency or bond returns, or other variables as desired by the user. If \dQuote{nlags} is \sQuote{NA} (default), then the function tries to find the best lag structure using the AIC. From noreply at r-forge.r-project.org Fri Mar 28 11:27:09 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 28 Mar 2014 11:27:09 +0100 (CET) Subject: [Eventstudies-commits] r243 - pkg Message-ID: <20140328102709.202E9187419@r-forge.r-project.org> Author: chiraganand Date: 2014-03-28 11:27:08 +0100 (Fri, 28 Mar 2014) New Revision: 243 Modified: pkg/DESCRIPTION Log: Added package date. Modified: pkg/DESCRIPTION =================================================================== --- pkg/DESCRIPTION 2014-03-28 08:38:06 UTC (rev 242) +++ pkg/DESCRIPTION 2014-03-28 10:27:08 UTC (rev 243) @@ -2,6 +2,7 @@ Type: Package Title: Event study analysis Version: 1.1 +Date: 2014-03-28 Author: Chirag Anand, Vikram Bahure, Vimal Balasubramaniam, Ajay Shah Maintainer: Vikram Bahure Depends: R (>= 2.12.0), zoo, xts, boot, testthat, sandwich From noreply at r-forge.r-project.org Fri Mar 28 11:34:34 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 28 Mar 2014 11:34:34 +0100 (CET) Subject: [Eventstudies-commits] r244 - pkg/man Message-ID: <20140328103434.85B44187478@r-forge.r-project.org> Author: chiraganand Date: 2014-03-28 11:34:34 +0100 (Fri, 28 Mar 2014) New Revision: 244 Modified: pkg/man/makeX.Rd Log: Changed description and details, needs fixing. Modified: pkg/man/makeX.Rd =================================================================== --- pkg/man/makeX.Rd 2014-03-28 10:27:08 UTC (rev 243) +++ pkg/man/makeX.Rd 2014-03-28 10:34:34 UTC (rev 244) @@ -1,12 +1,13 @@ \name{makeX} \alias{makeX} -\title{A function to prepare explanatory variables for computation of - Augmented Market Models used in lmAMM function.} +\title{Prepare explanatory variables for computation of Augmented Market + Models} -\description{This function creates a matrix of explanatory variables in - the form specified by the user for further estimation of Augmented - market models.} +\description{\sQuote{makeX} is used to prepare explanatory variables for + computation of Augmented Market Models. It can be used to create a + matrix of explanatory variables in the form specified by the user for + estimation of AMM.} \usage{ makeX(market.returns, @@ -19,35 +20,41 @@ } \arguments{ - %% FIXME: our example contains univariate time-series object. Can it - %% accept multiple columns as input? Here we are only supposed to use one column - \item{market.returns}{a \pkg{zoo} timeseries object. This is generally - fixed to the stock market index. The first column vector of this - matrix contains this variable. } + \item{market.returns}{a univariate timeseries object of \sQuote{class} + \pkg{zoo}. It is generally fixed to the stock market index.} + \item{others}{a \pkg{zoo} matrix with other regressors of interest in the AMM. This could be currency, bond returns, foreign flows, or any other variable.} \item{switch.to.innov}{a \sQuote{logical} vector with an element for - each column in \dQuote{others}. Whether to switch the column from - raw values to AR residuals.} + each column in \dQuote{others} specifying whether to switch the + column from raw values to AR residuals. Default is \sQuote{TRUE} for + all the columns.} - \item{market.returns.purge}{a \sQuote{logical} element, indicating + \item{market.returns.purge}{a \sQuote{logical} indicating whether to purge the effects of \dQuote{others} from \dQuote{market.returns}.} \item{nlags}{The number of lag terms present in this model explaining \dQuote{market.returns} using all these \dQuote{others}.} - \item{dates}{Specified break dates as \sQuote{Date} object (either from - structural breaks in exchange rate regimes) so that all these steps - are constructed within each sub-period divided by the dates.} + \item{dates}{Specified break dates as \sQuote{Date} object.} \item{verbose}{Whether detailed output is required. Default is \sQuote{FALSE}.} } +\details{ + + %% FIXME + \dQuote{dates} can be used to specify sub-periods for estimating + exposure of \dQuote{others}. The variables are constructed for each + sub-period separately. If no dates are provided, start date and end + date of the \dQuote{market.returns} series are taken. +} + \section{Warning}{The input data should not contain \sQuote{NA}s, as is required by the \dQuote{lm} function to compute linear estimates. Please use \sQuote{na.omit} before feeding data into this function.} From noreply at r-forge.r-project.org Fri Mar 28 11:35:09 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 28 Mar 2014 11:35:09 +0100 (CET) Subject: [Eventstudies-commits] r245 - pkg/R Message-ID: <20140328103509.82D74187488@r-forge.r-project.org> Author: chiraganand Date: 2014-03-28 11:35:09 +0100 (Fri, 28 Mar 2014) New Revision: 245 Modified: pkg/R/lmAmm.R Log: Fixed typo in comments. Modified: pkg/R/lmAmm.R =================================================================== --- pkg/R/lmAmm.R 2014-03-28 10:34:34 UTC (rev 244) +++ pkg/R/lmAmm.R 2014-03-28 10:35:09 UTC (rev 245) @@ -195,7 +195,7 @@ ########################### -# Maintaing NAs in AR model +# Maintaining NAs in AR model ########################### ARinnovations <- function(x) { stopifnot(NCOL(x) == 1) From noreply at r-forge.r-project.org Fri Mar 28 11:35:32 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 28 Mar 2014 11:35:32 +0100 (CET) Subject: [Eventstudies-commits] r246 - pkg/inst Message-ID: <20140328103532.C99DF18748C@r-forge.r-project.org> Author: vikram Date: 2014-03-28 11:35:32 +0100 (Fri, 28 Mar 2014) New Revision: 246 Added: pkg/inst/CITATION Log: Citation added Added: pkg/inst/CITATION =================================================================== --- pkg/inst/CITATION (rev 0) +++ pkg/inst/CITATION 2014-03-28 10:35:32 UTC (rev 246) @@ -0,0 +1,12 @@ + +bibentry(bibtype = "Manual", + title = ?{eventstudies}: An R package for researchers and users of event studie +s", + author = c(person(?Chirag?, ?Anand?), + person(?Vimal?, "Balasubramaniam?), + person(?Vikram?, ?Bahure?), + person(?Ajay?, "Shah?), + person("R Core Team")), + organisation = ?NIPFP, Macro/Finance group?, + year = 2014, + url = "http://CRAN.R-project.org/package=eventstudies?) From noreply at r-forge.r-project.org Fri Mar 28 12:55:31 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 28 Mar 2014 12:55:31 +0100 (CET) Subject: [Eventstudies-commits] r247 - pkg/inst Message-ID: <20140328115531.D0CAB187006@r-forge.r-project.org> Author: vikram Date: 2014-03-28 12:55:31 +0100 (Fri, 28 Mar 2014) New Revision: 247 Modified: pkg/inst/CITATION Log: Minor change in citation Modified: pkg/inst/CITATION =================================================================== --- pkg/inst/CITATION 2014-03-28 10:35:32 UTC (rev 246) +++ pkg/inst/CITATION 2014-03-28 11:55:31 UTC (rev 247) @@ -5,8 +5,7 @@ author = c(person(?Chirag?, ?Anand?), person(?Vimal?, "Balasubramaniam?), person(?Vikram?, ?Bahure?), - person(?Ajay?, "Shah?), - person("R Core Team")), + person(?Ajay?, "Shah?)), organisation = ?NIPFP, Macro/Finance group?, year = 2014, url = "http://CRAN.R-project.org/package=eventstudies?) From noreply at r-forge.r-project.org Fri Mar 28 13:14:23 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 28 Mar 2014 13:14:23 +0100 (CET) Subject: [Eventstudies-commits] r248 - pkg/man Message-ID: <20140328121423.30754185BDE@r-forge.r-project.org> Author: chiraganand Date: 2014-03-28 13:14:22 +0100 (Fri, 28 Mar 2014) New Revision: 248 Modified: pkg/man/eventstudy-package.Rd Log: Changed title and description of the package. Modified: pkg/man/eventstudy-package.Rd =================================================================== --- pkg/man/eventstudy-package.Rd 2014-03-28 11:55:31 UTC (rev 247) +++ pkg/man/eventstudy-package.Rd 2014-03-28 12:14:22 UTC (rev 248) @@ -3,21 +3,22 @@ \docType{package} \title{ -Event study analysis. + An R package for conducting event studies. } \description{ -This package is used for performing event study analysis in R. + \pkg{eventstudies} is an R package for conducting event studies and a + platform for methodological research on event studies. } \details{ -\tabular{ll}{ -Package: \tab eventstudies\cr -Type: \tab Package\cr -Version: \tab 1.1\cr -Date: \tab 2013-07-16\cr -License: \tab GPL 2\cr -LazyLoad: \tab yes\cr + \tabular{ll}{ + Package: \tab eventstudies\cr + Type: \tab Package\cr + Version: \tab 1.1\cr + Date: \tab 2014-03-28\cr + License: \tab GPL 2\cr + LazyLoad: \tab yes\cr } This package allows a dataset to be studied in an event-time frame and @@ -26,7 +27,7 @@ } \author{ -Ajay Shah, Chirag Anand, Vikram Bahure, Vimal Balasubramaniam +Chirag Anand, Vikram Bahure, Vimal Balasubramaniam, Ajay Shah Maintainer: Vikram Bahure } From noreply at r-forge.r-project.org Fri Mar 28 13:14:41 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 28 Mar 2014 13:14:41 +0100 (CET) Subject: [Eventstudies-commits] r249 - pkg/man Message-ID: <20140328121441.45582185BDE@r-forge.r-project.org> Author: vikram Date: 2014-03-28 13:14:41 +0100 (Fri, 28 Mar 2014) New Revision: 249 Modified: pkg/man/makeX.Rd Log: Added details for makeX function Modified: pkg/man/makeX.Rd =================================================================== --- pkg/man/makeX.Rd 2014-03-28 12:14:22 UTC (rev 248) +++ pkg/man/makeX.Rd 2014-03-28 12:14:41 UTC (rev 249) @@ -46,13 +46,8 @@ \sQuote{FALSE}.} } -\details{ +\details{ Augmented market model (AMM) purges out the variation of market returns and variable of interest as specified in \sQuote{others}, from the dependent variable. This function creates the regressors for the AMM model using market returns and \sQuote{others}. - %% FIXME - \dQuote{dates} can be used to specify sub-periods for estimating - exposure of \dQuote{others}. The variables are constructed for each - sub-period separately. If no dates are provided, start date and end - date of the \dQuote{market.returns} series are taken. } \section{Warning}{The input data should not contain \sQuote{NA}s, as is From noreply at r-forge.r-project.org Fri Mar 28 13:15:31 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 28 Mar 2014 13:15:31 +0100 (CET) Subject: [Eventstudies-commits] r250 - pkg/man Message-ID: <20140328121532.10ACF1864B3@r-forge.r-project.org> Author: chiraganand Date: 2014-03-28 13:15:31 +0100 (Fri, 28 Mar 2014) New Revision: 250 Added: pkg/man/eventstudies-package.Rd Removed: pkg/man/eventstudy-package.Rd Log: Changed man filename, the package is no longer called eventstudy. Copied: pkg/man/eventstudies-package.Rd (from rev 248, pkg/man/eventstudy-package.Rd) =================================================================== --- pkg/man/eventstudies-package.Rd (rev 0) +++ pkg/man/eventstudies-package.Rd 2014-03-28 12:15:31 UTC (rev 250) @@ -0,0 +1,36 @@ +\name{eventstudies-package} +\alias{eventstudies} +\docType{package} + +\title{ + An R package for conducting event studies. +} + +\description{ + \pkg{eventstudies} is an R package for conducting event studies and a + platform for methodological research on event studies. +} + +\details{ + \tabular{ll}{ + Package: \tab eventstudies\cr + Type: \tab Package\cr + Version: \tab 1.1\cr + Date: \tab 2014-03-28\cr + License: \tab GPL 2\cr + LazyLoad: \tab yes\cr +} + +This package allows a dataset to be studied in an event-time frame and +perform parametric / non-parametric analysis using several inference +procedures. +} + +\author{ +Chirag Anand, Vikram Bahure, Vimal Balasubramaniam, Ajay Shah + +Maintainer: Vikram Bahure +} + +\keyword{ eventstudies } + Deleted: pkg/man/eventstudy-package.Rd =================================================================== --- pkg/man/eventstudy-package.Rd 2014-03-28 12:14:41 UTC (rev 249) +++ pkg/man/eventstudy-package.Rd 2014-03-28 12:15:31 UTC (rev 250) @@ -1,36 +0,0 @@ -\name{eventstudies-package} -\alias{eventstudies} -\docType{package} - -\title{ - An R package for conducting event studies. -} - -\description{ - \pkg{eventstudies} is an R package for conducting event studies and a - platform for methodological research on event studies. -} - -\details{ - \tabular{ll}{ - Package: \tab eventstudies\cr - Type: \tab Package\cr - Version: \tab 1.1\cr - Date: \tab 2014-03-28\cr - License: \tab GPL 2\cr - LazyLoad: \tab yes\cr -} - -This package allows a dataset to be studied in an event-time frame and -perform parametric / non-parametric analysis using several inference -procedures. -} - -\author{ -Chirag Anand, Vikram Bahure, Vimal Balasubramaniam, Ajay Shah - -Maintainer: Vikram Bahure -} - -\keyword{ eventstudies } - From noreply at r-forge.r-project.org Fri Mar 28 14:03:57 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 28 Mar 2014 14:03:57 +0100 (CET) Subject: [Eventstudies-commits] r251 - pkg/R Message-ID: <20140328130357.128CB187396@r-forge.r-project.org> Author: chiraganand Date: 2014-03-28 14:03:55 +0100 (Fri, 28 Mar 2014) New Revision: 251 Modified: pkg/R/eventstudy.R Log: Removed NULL as the default value for firm.returns, its a mandatory argument. Modified: pkg/R/eventstudy.R =================================================================== --- pkg/R/eventstudy.R 2014-03-28 12:15:31 UTC (rev 250) +++ pkg/R/eventstudy.R 2014-03-28 13:03:55 UTC (rev 251) @@ -1,4 +1,4 @@ -eventstudy <- function(firm.returns = NULL, +eventstudy <- function(firm.returns, eventList, width = 10, is.levels = FALSE, @@ -9,6 +9,7 @@ inference.strategy = "bootstrap", ...) { # type = "marketResidual", "excessReturn", "AMM", "None" + ## arguments to the model extra.var <- list(...) if (type == "None" && !is.null(firm.returns)) { From noreply at r-forge.r-project.org Fri Mar 28 16:07:29 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 28 Mar 2014 16:07:29 +0100 (CET) Subject: [Eventstudies-commits] r252 - pkg/R Message-ID: <20140328150729.6C5D81874E3@r-forge.r-project.org> Author: chiraganand Date: 2014-03-28 16:07:27 +0100 (Fri, 28 Mar 2014) New Revision: 252 Modified: pkg/R/eventstudy.R pkg/R/phys2eventtime.R Log: Don't break if there are no successful outcomes, return NULL instead. Can handle univariate series now. All tests passing. Modified: pkg/R/eventstudy.R =================================================================== --- pkg/R/eventstudy.R 2014-03-28 13:03:55 UTC (rev 251) +++ pkg/R/eventstudy.R 2014-03-28 15:07:27 UTC (rev 252) @@ -69,21 +69,30 @@ ### Converting index outputModel to Date index(outputModel) <- as.Date(index(outputModel)) - ## Stop if there is only one firm: phys2eventtime breaks down - if(NCOL(outputModel)==1){stop("Event study does not work for one firm/column")} ### Convert to event frame es <- phys2eventtime(z=outputModel, events=eventList, width=width) - es.w <- window(es$z.e, start = -width, end = width) - ## Adding column names to event output - cn.names <- eventList[which(es$outcomes=="success"),1] + + if (is.null(es$z.e) || length(es$z.e) == 0) { + es.w <- NULL + cn.names <- character(length = 0) + } else { + es.w <- window(es$z.e, start = -width, end = width) + # Adding column names to event output + cn.names <- eventList[which(es$outcomes=="success"),1] + } + if(length(cn.names)==1){ cat("Event date exists only for",cn.names,"\n") inference <- FALSE cat("No inference strategy for one column","\n") + } else if (length(cn.names) == 0) { + ## skip everything + to.remap = FALSE + inference = FALSE } else { colnames(es.w) <- cn.names - } + } ### Remapping event frame if (to.remap == TRUE) { @@ -124,7 +133,7 @@ print.es <- function(x, ...){ cat("The", x$inference, "inference output for CI and", colnames(x$eventstudy.output)[2], "response:", "\n") - return(x$eventstudy.output) + print.default(x$eventstudy.output) } summary.es <- function(object, ...){ Modified: pkg/R/phys2eventtime.R =================================================================== --- pkg/R/phys2eventtime.R 2014-03-28 13:03:55 UTC (rev 251) +++ pkg/R/phys2eventtime.R 2014-03-28 15:07:27 UTC (rev 252) @@ -47,6 +47,11 @@ rownums <- grep("outcome", names(answer)) outcomes <- as.character(do.call("c", answer[rownums])) z.e <- do.call("cbind", answer[rownums[which(answer[rownums] == "success")] - 1]) + + if (length(z.e) == 0) { # no point of going forward + return(list(z.e = z.e, outcomes = factor(outcomes))) + } + colnames(z.e) <- which(outcomes == "success") ## Now worry about whether there's information within the event window From noreply at r-forge.r-project.org Fri Mar 28 16:10:42 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 28 Mar 2014 16:10:42 +0100 (CET) Subject: [Eventstudies-commits] r253 - pkg/R Message-ID: <20140328151042.2DE84183CF5@r-forge.r-project.org> Author: chiraganand Date: 2014-03-28 16:10:41 +0100 (Fri, 28 Mar 2014) New Revision: 253 Modified: pkg/R/eventstudy.R Log: Don't print no inference strategy warning for one series if inference was originally FALSE. Modified: pkg/R/eventstudy.R =================================================================== --- pkg/R/eventstudy.R 2014-03-28 15:07:27 UTC (rev 252) +++ pkg/R/eventstudy.R 2014-03-28 15:10:41 UTC (rev 253) @@ -84,8 +84,10 @@ if(length(cn.names)==1){ cat("Event date exists only for",cn.names,"\n") - inference <- FALSE - cat("No inference strategy for one column","\n") + if (inference == TRUE) { + warning("No inference strategy for one column","\n") + inference <- FALSE + } } else if (length(cn.names) == 0) { ## skip everything to.remap = FALSE From vimsaa at gmail.com Fri Mar 28 16:20:17 2014 From: vimsaa at gmail.com (Vimal Balasubramaniam) Date: Fri, 28 Mar 2014 15:20:17 +0000 Subject: [Eventstudies-commits] r252 - pkg/R In-Reply-To: <20140328150729.6C5D81874E3@r-forge.r-project.org> References: <20140328150729.6C5D81874E3@r-forge.r-project.org> Message-ID: On 28 March 2014 15:07, wrote: > ### Converting index outputModel to Date > index(outputModel) <- as.Date(index(outputModel)) > - ## Stop if there is only one firm: phys2eventtime breaks down > - if(NCOL(outputModel)==1){stop("Event study does not work for one > firm/column")} > Perfect. ### Convert to event frame > es <- phys2eventtime(z=outputModel, events=eventList, width=width) > - es.w <- window(es$z.e, start = -width, end = width) > - ## Adding column names to event output > - cn.names <- eventList[which(es$outcomes=="success"),1] > + > + if (is.null(es$z.e) || length(es$z.e) == 0) { > + es.w <- NULL > + cn.names <- character(length = 0) > + } else { > + es.w <- window(es$z.e, start = -width, end = width) > + # Adding column names to event > output > + cn.names <- eventList[which(es$outcomes=="success"),1] > + } > + > if(length(cn.names)==1){ > cat("Event date exists only for",cn.names,"\n") > inference <- FALSE > cat("No inference strategy for one column","\n") > + } else if (length(cn.names) == 0) { > + ## skip everything > + to.remap = FALSE > + inference = FALSE > } else { > colnames(es.w) <- cn.names > - } > + } > > Okay. I totally agree. This makes sense to me. Except this: es.w <- window(es$z.e, start = -width, end = width) That is not what should be done right? Because this will give you result from phys2eventtime as only for the width chosen! The width differentiates "wdatamissing" from "success". No? ### Remapping event frame > if (to.remap == TRUE) { > @@ -124,7 +133,7 @@ > print.es <- function(x, ...){ > cat("The", x$inference, "inference output for CI and", > colnames(x$eventstudy.output)[2], "response:", "\n") > - return(x$eventstudy.output) > + print.default(x$eventstudy.output) > } > > ? I don't get this. But I leave it to you. > summary.es <- function(object, ...){ > > Modified: pkg/R/phys2eventtime.R > =================================================================== > --- pkg/R/phys2eventtime.R 2014-03-28 13:03:55 UTC (rev 251) > +++ pkg/R/phys2eventtime.R 2014-03-28 15:07:27 UTC (rev 252) > @@ -47,6 +47,11 @@ > rownums <- grep("outcome", names(answer)) > outcomes <- as.character(do.call("c", answer[rownums])) > z.e <- do.call("cbind", answer[rownums[which(answer[rownums] == > "success")] - 1]) > + > + if (length(z.e) == 0) { # no point of going forward > + return(list(z.e = z.e, outcomes = factor(outcomes))) > + } > + > colnames(z.e) <- which(outcomes == "success") > Okay. This is fine too. -------------- next part -------------- An HTML attachment was scrubbed... URL: From noreply at r-forge.r-project.org Fri Mar 28 16:25:15 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 28 Mar 2014 16:25:15 +0100 (CET) Subject: [Eventstudies-commits] r254 - pkg/man Message-ID: <20140328152515.376A9187263@r-forge.r-project.org> Author: chiraganand Date: 2014-03-28 16:25:14 +0100 (Fri, 28 Mar 2014) New Revision: 254 Modified: pkg/man/phys2eventtime.Rd Log: Modified text structure, documented returning of NULL if there are no successful outcomes. Modified: pkg/man/phys2eventtime.Rd =================================================================== --- pkg/man/phys2eventtime.Rd 2014-03-28 15:10:41 UTC (rev 253) +++ pkg/man/phys2eventtime.Rd 2014-03-28 15:25:14 UTC (rev 254) @@ -5,9 +5,9 @@ Function to convert physical dates to event dates. } -\description{ Given a zoo time-series and event dates, it converts the - physical dates to event dates. The event date becomes zero and all - other dates shift accordingly. } +\description{ Given a zoo time-series and event dates, the function + converts the physical dates to event dates. The event date becomes + zero and all other dates shift accordingly. } \usage{ phys2eventtime(z, events, width = 10) @@ -15,28 +15,30 @@ \arguments{ \item{z}{an object of class \pkg{zoo} containing time series data for - which the event frame is to be generated. See \sQuote{Details}.} + which the event frame is to be generated.} \item{events}{ - \sQuote{data.frame} of two columns containing event - dates. \dQuote{outcome.unit} consists of column names of the event - stock, and \dQuote{event.when} is the respective event date. See - \sQuote{Details}. + \sQuote{data.frame} containing event dates. See \sQuote{Details}. } \item{width}{an \sQuote{integer} specifying the number of days on each - side of the event date. For a given width, if there is any \sQuote{NA} - in the event window, then the last observation is carried forward.} + side of the event date.} } \details{ - The function is used to convert physical dates to event - dates. If an event date is not found, the function takes the previous - value of date in \code{index(z)} as the event date. - Currently, this function requires \dQuote{z} to have at least one - \emph{column}. It relies on colnames of the object for the series + \dQuote{events} object contains two columns: \dQuote{outcome.unit} + consists of column names of the event stock, and \dQuote{event.when} + is the respective event date. If an event date is not found, the + function takes the previous value of date in \code{index(z)} as the + event date. + + For a given \dQuote{width}, if there is any \sQuote{NA} in the event + window, then the last observation is carried forward.} + + Currently this function requires \dQuote{z} to have at least one + \emph{column}. It relies on \sQuote{colnames} of z for the series names, and matches it with the \dQuote{events} object. One can use \code{drop = FALSE} with \sQuote{[} to achieve a single-column object. } @@ -44,7 +46,8 @@ \value{ Returns a \sQuote{list} of two elements: - \item{z.e}{a zoo object indexed with event time.} + \item{z.e}{a zoo object indexed with event time; \dQuote{NULL} if + there are no \dQuote{success} \dQuote{outcomes}.} \item{outcomes}{a character vector with outcome of each event date:} @@ -59,7 +62,7 @@ \examples{ data(StockPriceReturns) data(SplitDates) -phys2eventtime(z = StockPriceReturns, events = SplitDates,width = 5) +phys2eventtime(z = StockPriceReturns, events = SplitDates, width = 5) } \keyword{ phys2eventime } From noreply at r-forge.r-project.org Fri Mar 28 17:33:02 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 28 Mar 2014 17:33:02 +0100 (CET) Subject: [Eventstudies-commits] r255 - pkg/man Message-ID: <20140328163302.2C55E1872F4@r-forge.r-project.org> Author: chiraganand Date: 2014-03-28 17:33:01 +0100 (Fri, 28 Mar 2014) New Revision: 255 Modified: pkg/man/eventstudy.Rd Log: Added description of arguments, added return value for unscuccessful outcomes, changed function description and title. Modified: pkg/man/eventstudy.Rd =================================================================== --- pkg/man/eventstudy.Rd 2014-03-28 15:25:14 UTC (rev 254) +++ pkg/man/eventstudy.Rd 2014-03-28 16:33:01 UTC (rev 255) @@ -1,12 +1,17 @@ \name{eventstudy} \alias{eventstudy} -\title{Event study analysis} +\title{Function for performing event study analysis} -\description{This function performs event study analysis and further computes confidence interval} +\description{ + %% FIXME + \sQuote{eventstudy} performs event study analysis. It calculates + returns using a specified model, converts physical dates to event + frame, and conducts inference on the unit of interest. +} \usage{ -eventstudy(firm.returns = NULL, +eventstudy(firm.returns, eventList, width = 10, is.levels = FALSE, @@ -20,23 +25,22 @@ \arguments{ \item{firm.returns}{ - data on which event study is to be performed. + a \pkg{zoo} timeseries on which event study is to be performed. } \item{eventList}{ - \sQuote{data.frame} of two columns containing event - dates. \dQuote{outcome.unit} consists of column names of the event - stock, and \dQuote{event.when} is the respective event date. + \sQuote{data.frame} of two columns containing event dates to pass to + \code{\link{phys2eventtime}} function. \dQuote{outcome.unit} + consists of column names of series inside \dQuote{firm.returns}, and + \dQuote{event.when} is the respective event date. } - \item{width}{integer of length 1, which creates an event window to + \item{width}{integer of length 1, creates an event window to study the impact (pre and post event) on the variable.} \item{type}{ a scalar of type \sQuote{character} specifying the market - model adjustment. Currently supported options are: - \dQuote{marketResidual}, \dQuote{excessReturn}, \dQuote{lmAMM} and - \dQuote{None}. Defaults to \dQuote{marketResidual}. See \sQuote{Details}. + model adjustment. See \sQuote{Details}. } \item{to.remap}{\sQuote{logical}, indicating whether to convert @@ -73,8 +77,39 @@ } } -\details{This function performs event study analysis using basic functions from the package. -The function needs firm returns as input and provides argument \sQuote{type} to generate abnormal returns, if required. If \sQuote{type} is \sQuote{market.residuals} then it will generate abnormal returns using a market model. It also provides option to estimate returns using augmented market model (AMM) which purges out market returns and \sQuote{others} i.e. currency in our case (\sQuote{type} as \sQuote{lmAMM}). The function computes confidence interval using either bootstrap or wilcoxon technique. The output of this function has class \sQuote{es}. +\details{ + + \dQuote{firm.returns} may contain only one series. For performing + analysis for a single series, use \sQuote{[} with \code{drop = + FALSE} for subsetting the data set. See \code{\link{phys2eventtime}} + for more details. + + \dQuote{type} currently supports: + \itemize{ + \item{\dQuote{marketResidual}: uses \code{\link{marketResidual}()} to + extract market returns from firms return using a linear model.} + + \item{\dQuote{excessReturn}: uses \code{\link{excessReturn}()} to + subtract market return from firm return.} + + \item{\dQuote{lmAMM}: uses \code{\link{lmAMM}()} to perform + Augmented Market Model estimation.} + + \item{\dQuote{None}: don't use any model.} + } + + + The function needs firm returns as input and provides + argument \sQuote{type} to generate abnormal returns, if required. If + \sQuote{type} is \sQuote{market.residuals} then it will generate + abnormal returns using a market model. It also provides option to + estimate returns using augmented market model (AMM) which purges out + market returns and \sQuote{others} i.e. currency in our case + (\sQuote{type} as \sQuote{lmAMM}). The function computes confidence + interval using either bootstrap or wilcoxon technique. The output of + this function has class \sQuote{es}. + + } \value{ @@ -82,8 +117,9 @@ following elements: \item{eventstudy.output}{ - a \sQuote{matrix} containing mean/median estimate with confidence -- interval + a \sQuote{matrix} containing mean/median estimate with + confidence interval; \sQuote{NULL} if there are no \dQuote{success} + \dQuote{outcomes}. } \item{outcomes}{a character vector having outcome of each event date:} From noreply at r-forge.r-project.org Fri Mar 28 19:31:56 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Fri, 28 Mar 2014 19:31:56 +0100 (CET) Subject: [Eventstudies-commits] r256 - pkg/man Message-ID: <20140328183156.B011A18728C@r-forge.r-project.org> Author: chiraganand Date: 2014-03-28 19:31:56 +0100 (Fri, 28 Mar 2014) New Revision: 256 Modified: pkg/man/eventstudy.Rd Log: Added description of more arguments. Modified: pkg/man/eventstudy.Rd =================================================================== --- pkg/man/eventstudy.Rd 2014-03-28 16:33:01 UTC (rev 255) +++ pkg/man/eventstudy.Rd 2014-03-28 18:31:56 UTC (rev 256) @@ -48,20 +48,15 @@ re-index.} \item{remap}{ - \sQuote{character}, this argument is used when \dQuote{to.remap} is - \sQuote{TRUE}. Takes three values (defaults to \dQuote{cumsum}): - \itemize{ - \item{cumsum: cumulative sum.} - \item{cumprod: cumulative product, buy-hold-abnormal-return (BHAR).} - \item{reindex: re-indexing the event window.} - } + \sQuote{character}, conversion function for remapping event-window + returns. Used when \dQuote{to.remap} is \sQuote{TRUE}. } \item{is.levels}{ \sQuote{logical}, indicating the format of the data. Set it to \sQuote{FALSE} if the data is in returns format, else \sQuote{TRUE}. } - + %% FIXME: do you compute confidence interval or use it for computing? \item{inference}{ \sQuote{logical}, specifying whether to compute confidence interval for the estimator. @@ -86,30 +81,31 @@ \dQuote{type} currently supports: \itemize{ - \item{\dQuote{marketResidual}: uses \code{\link{marketResidual}()} to + \item{\dQuote{marketResidual}: uses \code{\link{marketResidual}} to extract market returns from firms return using a linear model.} - \item{\dQuote{excessReturn}: uses \code{\link{excessReturn}()} to + \item{\dQuote{excessReturn}: uses \code{\link{excessReturn}} to subtract market return from firm return.} - \item{\dQuote{lmAMM}: uses \code{\link{lmAMM}()} to perform + \item{\dQuote{lmAMM}: uses \code{\link{lmAMM}} to perform Augmented Market Model estimation.} \item{\dQuote{None}: don't use any model.} } - - The function needs firm returns as input and provides - argument \sQuote{type} to generate abnormal returns, if required. If - \sQuote{type} is \sQuote{market.residuals} then it will generate - abnormal returns using a market model. It also provides option to - estimate returns using augmented market model (AMM) which purges out - market returns and \sQuote{others} i.e. currency in our case - (\sQuote{type} as \sQuote{lmAMM}). The function computes confidence - interval using either bootstrap or wilcoxon technique. The output of - this function has class \sQuote{es}. + \dQuote{remap} can take three values: + \itemize{ + \item{\dQuote{cumsum}: cumulative sum, uses \code{\link{remap.cumsum}}. [Default]} + \item{\dQuote{cumprod}: cumulative product, buy-hold-abnormal-return (BHAR), + uses \code{\link{remap.cumprod}}.} + \item{\dQuote{reindex}: re-indexes the event window by using + \code{\link{remap.event.reindex}}.} + } - + For computing confidence intervals, the function can either use + bootstrap or Wilcoxon signed-rank test. See + \code{\link{inference.bootstrap}} and \code{\link{inference.wilcox}} + for more details. } \value{ From noreply at r-forge.r-project.org Sat Mar 29 14:54:30 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 29 Mar 2014 14:54:30 +0100 (CET) Subject: [Eventstudies-commits] r257 - pkg/man Message-ID: <20140329135430.2C17C187316@r-forge.r-project.org> Author: chiraganand Date: 2014-03-29 14:54:29 +0100 (Sat, 29 Mar 2014) New Revision: 257 Modified: pkg/man/eventstudy.Rd Log: Added list of arguments accepted by the models. Modified: pkg/man/eventstudy.Rd =================================================================== --- pkg/man/eventstudy.Rd 2014-03-28 18:31:56 UTC (rev 256) +++ pkg/man/eventstudy.Rd 2014-03-29 13:54:29 UTC (rev 257) @@ -81,8 +81,9 @@ \dQuote{type} currently supports: \itemize{ - \item{\dQuote{marketResidual}: uses \code{\link{marketResidual}} to - extract market returns from firms return using a linear model.} + \item{\dQuote{marketResidual}: uses \code{\link{marketResidual}} + function to extract market returns from firms return using a + linear model.} \item{\dQuote{excessReturn}: uses \code{\link{excessReturn}} to subtract market return from firm return.} @@ -92,22 +93,51 @@ \item{\dQuote{None}: don't use any model.} } + Arguments to a model type can be sent inside \sQuote{...}. See + \sQuote{Model arguments} section for details on accepted fields. \dQuote{remap} can take three values: \itemize{ - \item{\dQuote{cumsum}: cumulative sum, uses \code{\link{remap.cumsum}}. [Default]} - \item{\dQuote{cumprod}: cumulative product, buy-hold-abnormal-return (BHAR), - uses \code{\link{remap.cumprod}}.} - \item{\dQuote{reindex}: re-indexes the event window by using - \code{\link{remap.event.reindex}}.} + \item \dQuote{cumsum}: cumulative sum, uses \code{\link{remap.cumsum}}. [Default] + \item \dQuote{cumprod}: cumulative product, buy-hold-abnormal-return (BHAR), + uses \code{\link{remap.cumprod}}. + \item \dQuote{reindex}: re-indexes the event window by using + \code{\link{remap.event.reindex}}. } For computing confidence intervals, the function can either use bootstrap or Wilcoxon signed-rank test. See \code{\link{inference.bootstrap}} and \code{\link{inference.wilcox}} for more details. + + \sQuote{...} is directly supplied to the model mentioned in the + \dQuote{type} argument. See section on \sQuote{Model arguments} for + more details. } +\section{\bold{Model arguments}}{ + Each model can take extra arguments (supplied as \sQuote{...}) apart + from mandatory ones for finer control over the analysis. Check the + respective function documentation for definitions. The arguments are + listed here: + + \itemize{ + \item \dQuote{marketResidual}: \cr + - market.returns + \item \dQuote{excessReturn}: \cr + - market.returns + \item \dQuote{lmAMM}: \cr + - market.returns \cr + - others \cr + - switch.to.innov \cr + - market.returns.purge \cr + - nlags \cr + - dates \cr + - verbose \cr + } +} + + \value{ A list with class attribute \dQuote{es} holding the following elements: From noreply at r-forge.r-project.org Sat Mar 29 14:59:18 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 29 Mar 2014 14:59:18 +0100 (CET) Subject: [Eventstudies-commits] r258 - pkg/R Message-ID: <20140329135918.60E8618739C@r-forge.r-project.org> Author: chiraganand Date: 2014-03-29 14:59:17 +0100 (Sat, 29 Mar 2014) New Revision: 258 Modified: pkg/R/inference.bootstrap.R Log: Removed library calls from the code. Modified: pkg/R/inference.bootstrap.R =================================================================== --- pkg/R/inference.bootstrap.R 2014-03-29 13:54:29 UTC (rev 257) +++ pkg/R/inference.bootstrap.R 2014-03-29 13:59:17 UTC (rev 258) @@ -1,6 +1,3 @@ -library(boot) -library(zoo) - # This does bootstrap inference for the difference in the # average "car" between t1 and t2 (both in event time). # es.w is a zoo object, where rows are in event time From noreply at r-forge.r-project.org Sat Mar 29 15:12:54 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 29 Mar 2014 15:12:54 +0100 (CET) Subject: [Eventstudies-commits] r259 - pkg/man Message-ID: <20140329141254.36D34184F56@r-forge.r-project.org> Author: chiraganand Date: 2014-03-29 15:12:53 +0100 (Sat, 29 Mar 2014) New Revision: 259 Modified: pkg/man/ees.Rd Log: Small text change. Modified: pkg/man/ees.Rd =================================================================== --- pkg/man/ees.Rd 2014-03-29 13:59:17 UTC (rev 258) +++ pkg/man/ees.Rd 2014-03-29 14:12:53 UTC (rev 259) @@ -5,9 +5,9 @@ Extreme events study analysis for a univariate time series } -\description{This function identifies tail events on a univariate time - series, generates summary statistics for clustered and unclustered - tail events.} +\description{This function is used to identify tail events on a + univariate time series. It generates summary statistics for clustered and + unclustered tail events.} \usage{ ees(input, prob.value) @@ -15,10 +15,10 @@ \arguments{ - \item{input}{a univariate \pkg{zoo} time series for which tail events - identification is required.} + \item{input}{a univariate \pkg{zoo} or \pkg{xts} time series for which + tail events identification is required.} - \item{prob.value}{The cut off (in percent) on the probability + \item{prob.value}{The cut off (in per cent) on the probability distribution for the tail event.} } From noreply at r-forge.r-project.org Sat Mar 29 15:23:18 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 29 Mar 2014 15:23:18 +0100 (CET) Subject: [Eventstudies-commits] r260 - pkg/man Message-ID: <20140329142319.02890186D52@r-forge.r-project.org> Author: chiraganand Date: 2014-03-29 15:23:18 +0100 (Sat, 29 Mar 2014) New Revision: 260 Modified: pkg/man/eesPlot.Rd Log: Rearranged text. Modified: pkg/man/eesPlot.Rd =================================================================== --- pkg/man/eesPlot.Rd 2014-03-29 14:12:53 UTC (rev 259) +++ pkg/man/eesPlot.Rd 2014-03-29 14:23:18 UTC (rev 260) @@ -7,9 +7,7 @@ \description{The function creates an event study plot that treats all clustered events as one event. It plots both the lower and upper tail - events and the events are defined based on the cut off probability - values provided (in percentage terms).This function replicates result - of Patnaik, Shah, and Singh (2013).} + events.} \usage{ eesPlot(z, @@ -42,10 +40,15 @@ percentage terms).} } +\details{ + The events are defined based on the cut off probability values + provided (in percentage terms).This function replicates result of + Patnaik, Shah, and Singh (2013). +} + \value{A plot of the response series with lower and upper tail events defined on the event series.} -%% FIXME: example doesn't work! \examples{ library(eventstudies) data(eesData) From noreply at r-forge.r-project.org Sat Mar 29 15:25:20 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 29 Mar 2014 15:25:20 +0100 (CET) Subject: [Eventstudies-commits] r261 - pkg/man Message-ID: <20140329142520.DAF21186E86@r-forge.r-project.org> Author: chiraganand Date: 2014-03-29 15:25:20 +0100 (Sat, 29 Mar 2014) New Revision: 261 Modified: pkg/man/excessReturn.Rd Log: Shortened the title. Modified: pkg/man/excessReturn.Rd =================================================================== --- pkg/man/excessReturn.Rd 2014-03-29 14:23:18 UTC (rev 260) +++ pkg/man/excessReturn.Rd 2014-03-29 14:25:20 UTC (rev 261) @@ -1,7 +1,7 @@ \name{excessReturn} \alias{excessReturn} -\title{A function that estimates excess return} +\title{Estimate excess returns} \description{ This function estimates excess returns. If the firm return is \dQuote{firm.returns} and market return is \dQuote{market.returns}, From noreply at r-forge.r-project.org Sat Mar 29 15:55:11 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 29 Mar 2014 15:55:11 +0100 (CET) Subject: [Eventstudies-commits] r262 - pkg/man Message-ID: <20140329145512.0AB8A187302@r-forge.r-project.org> Author: chiraganand Date: 2014-03-29 15:55:11 +0100 (Sat, 29 Mar 2014) New Revision: 262 Modified: pkg/man/phys2eventtime.Rd Log: Added lvalue to example result, removed extra brace. Modified: pkg/man/phys2eventtime.Rd =================================================================== --- pkg/man/phys2eventtime.Rd 2014-03-29 14:25:20 UTC (rev 261) +++ pkg/man/phys2eventtime.Rd 2014-03-29 14:55:11 UTC (rev 262) @@ -35,7 +35,7 @@ event date. For a given \dQuote{width}, if there is any \sQuote{NA} in the event - window, then the last observation is carried forward.} + window, then the last observation is carried forward. Currently this function requires \dQuote{z} to have at least one \emph{column}. It relies on \sQuote{colnames} of z for the series @@ -62,7 +62,7 @@ \examples{ data(StockPriceReturns) data(SplitDates) -phys2eventtime(z = StockPriceReturns, events = SplitDates, width = 5) +result <- phys2eventtime(z = StockPriceReturns, events = SplitDates, width = 5) } \keyword{ phys2eventime } From noreply at r-forge.r-project.org Sat Mar 29 19:00:15 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sat, 29 Mar 2014 19:00:15 +0100 (CET) Subject: [Eventstudies-commits] r263 - in pkg: R man Message-ID: <20140329180015.3A21D18732E@r-forge.r-project.org> Author: chiraganand Date: 2014-03-29 19:00:14 +0100 (Sat, 29 Mar 2014) New Revision: 263 Modified: pkg/R/phys2eventtime.R pkg/man/phys2eventtime.Rd Log: Modified comments in the function, changed text in the manual. Modified: pkg/R/phys2eventtime.R =================================================================== --- pkg/R/phys2eventtime.R 2014-03-29 14:55:11 UTC (rev 262) +++ pkg/R/phys2eventtime.R 2014-03-29 18:00:14 UTC (rev 263) @@ -1,4 +1,4 @@ -# Upon input +# Upon input # z is a zoo object containing input data. E.g. this could be all the # prices of a bunch of stocks. The column name is the unit name. # events is a data.frame containing 2 columns. The first column @@ -10,20 +10,17 @@ # wdatamissing: too many NAs within the crucial event window. # success : all is well. # A vector of these outcomes is returned. + phys2eventtime <- function(z, events, width=10) { - # Just in case events$outcome.unit has been sent in as a factor -- + ## Ensuring class of event matrix events$outcome.unit <- as.character(events$outcome.unit) - if(is.factor(events$event.when)) stop("Sorry you provided a factor as an index") - # Given a zoo time-series z, and an event date "event.when", - # try to shift this vector into event time, where the event date - # becomes 0 and all other dates shift correspondingly. - # If this can't be done, then send back NULL with an error code. - ## takes the event list as an argument and uses already existing - ## time-series variable z + if(is.factor(events$event.when)) { + stop("The column 'event.when' cannot be a factor. Cannot proceed with data manipulation.") + } - # check the dimensions of "z"" + ## z: physical time matrix. Check dimensions of "z" if (is.null(ncol(z))) { - stop(paste(deparse("z"), "should be a zoo series with at least one column.")) + stop(paste(deparse("z"), "should be of class zoo/xts with at least one column.")) } timeshift <- function(x) { @@ -31,9 +28,7 @@ if (!firm.present) { return(list(result=NULL, outcome="unitmissing")) } - # take the previous date if - # the exact event date is not - # found + ## Take previous date if exact data is not found. location <- findInterval(as.Date(x[2]), index(z[, x[1]])) if ((location <= 1) | (location >= length(index(z)))) { return(list(result=NULL, outcome="wrongspan")) @@ -48,14 +43,15 @@ outcomes <- as.character(do.call("c", answer[rownums])) z.e <- do.call("cbind", answer[rownums[which(answer[rownums] == "success")] - 1]) - if (length(z.e) == 0) { # no point of going forward - return(list(z.e = z.e, outcomes = factor(outcomes))) + ## If no successful outcome, return NULL to z.e. + if (length(z.e) == 0) { + return(list(z.e = NULL, outcomes = factor(outcomes))) } colnames(z.e) <- which(outcomes == "success") - ## Now worry about whether there's information within the event window - ## (This entire cleaning+checking can be switched off by specifying width=0) + ## Information verification within 'width' + ## :: Will not be executed with width = 0 badcolumns <- NULL if (width > 0) { for (i in 1:ncol(z.e)) { @@ -72,7 +68,7 @@ z.e <- z.e[, -badcolumns] } } - # Check that we're okay + ## Double check stopifnot(sum(outcomes=="success") == NCOL(z.e)) list(z.e=z.e, outcomes=factor(outcomes)) } Modified: pkg/man/phys2eventtime.Rd =================================================================== --- pkg/man/phys2eventtime.Rd 2014-03-29 14:55:11 UTC (rev 262) +++ pkg/man/phys2eventtime.Rd 2014-03-29 18:00:14 UTC (rev 263) @@ -2,43 +2,52 @@ \alias{phys2eventtime} \title{ - Function to convert physical dates to event dates. + Convert data from physical to event time } -\description{ Given a zoo time-series and event dates, the function - converts the physical dates to event dates. The event date becomes - zero and all other dates shift accordingly. } +\description{\sQuote{phys2eventtime} is used to convert data from + physical to event time using information on events identified by the + user.} \usage{ phys2eventtime(z, events, width = 10) } \arguments{ - \item{z}{an object of class \pkg{zoo} containing time series data for - which the event frame is to be generated.} + \item{z}{an object of class \pkg{zoo} or \pkg{xts} containing data to + be converted into event time.} \item{events}{ - \sQuote{data.frame} containing event dates. See \sQuote{Details}. + \sQuote{data.frame} containing event identifiers. See \sQuote{Details}. } - \item{width}{an \sQuote{integer} specifying the number of days on each - side of the event date.} + \item{width}{an \sQuote{integer} specifying the event window within + which data should be available to consider the outcome a 'success'. See + \sQuote{Details}.} } \details{ \dQuote{events} object contains two columns: \dQuote{outcome.unit} - consists of column names of the event stock, and \dQuote{event.when} - is the respective event date. If an event date is not found, the - function takes the previous value of date in \code{index(z)} as the - event date. + consists of names of the event, and \dQuote{event.when} is the + respective event identifier. For instance, if \sQuote{z} is a matrix + of class \pkg{xts} with 10 stocks over 300 days, the names of stocks + in \sQuote{z} is the superset of names for the event and the time + period (i.e., 300 days) will be the superset for defining event dates. + If an event date does not lie within this period, the function + approximates to the nearest previous date using + \code{\link{findInterval}}. - For a given \dQuote{width}, if there is any \sQuote{NA} in the event - window, then the last observation is carried forward. + The argument \dQuote{width} provides the user with an option to define + successful events as those that have data within a window around the + event. If \dQuote{width} is 10 periods, those events with \sQuote{NA} + within 10 periods before and after the event will be classified as + \dQuote{wdatamissing}, otherwise, the event \dQuote{outcome} will be + classified as \dQuote{success}. Currently this function requires \dQuote{z} to have at least one - \emph{column}. It relies on \sQuote{colnames} of z for the series + \emph{column}. It relies on \sQuote{colnames} of \dQuote{z} for the series names, and matches it with the \dQuote{events} object. One can use \code{drop = FALSE} with \sQuote{[} to achieve a single-column object. } @@ -46,24 +55,29 @@ \value{ Returns a \sQuote{list} of two elements: - \item{z.e}{a zoo object indexed with event time; \dQuote{NULL} if - there are no \dQuote{success} \dQuote{outcomes}.} + \item{z.e}{a \pkg{zoo}/\pkg{xts} object indexed with event time; \dQuote{NULL} if + there are no \dQuote{success} in \dQuote{outcomes}.} - \item{outcomes}{a character vector with outcome of each event date:} - + \item{outcomes}{a character vector with outcome definition for each event.} \itemize{ - \item{success: shows the successful use of event date.} - \item{wdatamissing: appears when width data is missing around the event.} - \item{wrongspan: if event date falls outside the range of physical date.} - \item{unitmissing: when the unit (firm name) is missing in the event list.} + \item{success: the successful use of an event.} + \item{wdatamissing: when the \dQuote{width} condition is not satisfied.} + \item{wrongspan: when event date cannot be mapped to the physical + time in \dQuote{z}.} + \item{unitmissing: when the unit (a column) is missing in \dQuote{z}.} } } +\seealso{ + \code{\link{findInterval}} +} + \examples{ data(StockPriceReturns) data(SplitDates) -result <- phys2eventtime(z = StockPriceReturns, events = SplitDates, width = 5) +result <- phys2eventtime(z = StockPriceReturns, + events = SplitDates, + width = 5) } -\keyword{ phys2eventime } - +\keyword{phys2eventime} From noreply at r-forge.r-project.org Sun Mar 30 09:31:17 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Sun, 30 Mar 2014 09:31:17 +0200 (CEST) Subject: [Eventstudies-commits] r264 - pkg/man Message-ID: <20140330073118.09A661874EB@r-forge.r-project.org> Author: vikram Date: 2014-03-30 09:31:10 +0200 (Sun, 30 Mar 2014) New Revision: 264 Modified: pkg/man/ees.Rd pkg/man/eesPlot.Rd Log: Added details for extreme event analysis function Modified: pkg/man/ees.Rd =================================================================== --- pkg/man/ees.Rd 2014-03-29 18:00:14 UTC (rev 263) +++ pkg/man/ees.Rd 2014-03-30 07:31:10 UTC (rev 264) @@ -2,12 +2,10 @@ \alias{ees} \title{ -Extreme events study analysis for a univariate time series +Extreme events study analysis: Summary statistics } -\description{This function is used to identify tail events on a - univariate time series. It generates summary statistics for clustered and - unclustered tail events.} +\description{ This function generates summary statistics table from Patnaik, Shah and Singh (2013), using a univariate time series.} \usage{ ees(input, prob.value) @@ -22,6 +20,17 @@ distribution for the tail event.} } +\details{ Patnaik, Shah and Singh (2013) uses modified event study methodology in the paper, which is used to understand the impact of extreme tail events on a given variable (foreign investment, stock market returns in this case). Event dates are defined as those on which extreme values of returns or flows are observed. The argument \sQuote{prob.value} defines the extreme tail values on both side of the distribution as event dates. For instance, if \sQuote{prob.value} is 2.5 then it will consider 2.5 percent tail values on both side of the empirical distribution of the variable as event dates. The paper further differentiates between clustered events (consecutive extreme events) and unclustered events which is described in detail in summary tables. +This function helps to understand the various feature of the event dates by providing following summary statistics: + \itemize{ + \item \dQuote{Distribution of extreme events}: Number of events in clustered, unclustered and events used and discarded from the analysis + \item \dQuote{Run length distribution}: Table shows number of clustered events with a particular run length + \item \dQuote{Quantile values}: Quantile wise distribution of extreme events + \item \dQuote{Yearly distribution}: Year wise distribution of extreme events + } + Please refer to Patnaik, Shah and Singh (2013) for more detailed explanation. +} + \value{ A \code{list} object containing: \item{data.summary}{a \sQuote{data.frame} containing summary of Modified: pkg/man/eesPlot.Rd =================================================================== --- pkg/man/eesPlot.Rd 2014-03-29 18:00:14 UTC (rev 263) +++ pkg/man/eesPlot.Rd 2014-03-30 07:31:10 UTC (rev 264) @@ -2,12 +2,11 @@ \alias{eesPlot} \title{ -Plotting clustered and unclustered extreme events retuns. +Extreme event study analysis: Plotting clustered and unclustered extreme events returns } -\description{The function creates an event study plot that treats all - clustered events as one event. It plots both the lower and upper tail - events.} +\description{ This function uses modified event study methodology from Patnaik, Shah and Singh (2013) to plot the impact of event series on the response series. +} \usage{ eesPlot(z, @@ -40,10 +39,11 @@ percentage terms).} } -\details{ - The events are defined based on the cut off probability values - provided (in percentage terms).This function replicates result of - Patnaik, Shah, and Singh (2013). +\details{Patnaik, Shah, and Singh (2013) use modified event study methodology to draw the event study plot. The function draws the event dates from the tail of the event series. Extreme events are then formatted by fusing the consecutive events on same side of the tail into one event, further fusing the response series on a clustered event and removing the mixed clusters (consecutive events from left and right tails). After formatting the events, response series is converted to event time frame and mean response is constructed for all event dates. The function also estimates confidence interval using bootstrap inference strategy. + +The paper defines extreme tail events as event dates and the argument \sQuote{prob.value} is used for the same. The function using the argument \sQuote{event.series.name} picks a column from the data object \sQuote{z}, which is used to extract extreme event dates. While, argument \sQuote{response.series.name} gets the response series on which impact of the extreme event dates is to be analysed. + +Please refer to the paper Patnaik, Shah and Singh (2013) for detailed explanation. } \value{A plot of the response series with lower and upper tail events From noreply at r-forge.r-project.org Mon Mar 31 20:10:49 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Mon, 31 Mar 2014 20:10:49 +0200 (CEST) Subject: [Eventstudies-commits] r265 - pkg/man Message-ID: <20140331181049.A9C87183DCB@r-forge.r-project.org> Author: chiraganand Date: 2014-03-31 20:10:49 +0200 (Mon, 31 Mar 2014) New Revision: 265 Modified: pkg/man/inference.bootstrap.Rd Log: Changed title text, added small detail, needs to be expanded. Modified: pkg/man/inference.bootstrap.Rd =================================================================== --- pkg/man/inference.bootstrap.Rd 2014-03-30 07:31:10 UTC (rev 264) +++ pkg/man/inference.bootstrap.Rd 2014-03-31 18:10:49 UTC (rev 265) @@ -1,7 +1,7 @@ \name{inference.bootstrap} \alias{inference.bootstrap} -\title{Function to do bootstrap inference for event study analysis.} +\title{Do bootstrap inference for event study analysis} \description{ This function does bootstrap inference to generate distribution of @@ -19,7 +19,7 @@ \arguments{ \item{es.w}{ a \pkg{zoo} series indexed by event time: the \dQuote{z.e} - component of the list returned by the \sQuote{phys2eventtime()} + component of the list returned by the \code{\link{phys2eventtime}} function. } @@ -38,6 +38,12 @@ \sQuote{TRUE}.} } +%% FIXME: more details +\details{ + Function \sQuote{boot} from package \pkg{boot} is used for + bootstrapping with \emph{replicates} of 1000. +} + \value{ A \sQuote{matrix} with 3 columns, the lower confidence interval (CI), the mean, and the upper CI which are the result of bootstrap From noreply at r-forge.r-project.org Mon Mar 31 20:18:16 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Mon, 31 Mar 2014 20:18:16 +0200 (CEST) Subject: [Eventstudies-commits] r266 - pkg/man Message-ID: <20140331181816.7DC55186F7A@r-forge.r-project.org> Author: chiraganand Date: 2014-03-31 20:18:16 +0200 (Mon, 31 Mar 2014) New Revision: 266 Modified: pkg/man/inference.bootstrap.Rd pkg/man/inference.wilcox.Rd Log: Added proper links inside seealso section, changed description a bit. Modified: pkg/man/inference.bootstrap.Rd =================================================================== --- pkg/man/inference.bootstrap.Rd 2014-03-31 18:10:49 UTC (rev 265) +++ pkg/man/inference.bootstrap.Rd 2014-03-31 18:18:16 UTC (rev 266) @@ -51,7 +51,9 @@ } \seealso{ - phys2eventtime + \code{\link{boot}} + \code{\link{phys2eventtime}} + \code{\link{inference.wilcox}} } \examples{ Modified: pkg/man/inference.wilcox.Rd =================================================================== --- pkg/man/inference.wilcox.Rd 2014-03-31 18:10:49 UTC (rev 265) +++ pkg/man/inference.wilcox.Rd 2014-03-31 18:18:16 UTC (rev 266) @@ -2,12 +2,13 @@ \alias{inference.wilcox} \title{ - Wilcox inference for the event study. + Wilcox inference for event study analysis } \description{ -This function does wilcox inference to generate distribution of average of all the cumulative returns time-series. - } + This function does wilcox inference to generate distribution of average + of all the cumulative returns time-series. +} \usage{ inference.wilcox(es.w, @@ -23,25 +24,31 @@ \dQuote{z.e} component of the list returned by function \dQuote{phys2eventtime}.} - \item{to.plot}{a \sQuote{logical}. Whether to generate an eventstudy plot of the - inference estimated. Default is \sQuote{TRUE}.} + \item{to.plot}{a \sQuote{logical}. indicating whether to generate an + eventstudy plot of the inference estimated. Defaults to + \sQuote{TRUE}. + } - \item{xlab}{If to.plot is \sQuote{TRUE}, then the plot generated will take this X label.} + \item{xlab}{the x-axis label of the generated plot. Used if + \dQuote{to.plot} is \sQuote{TRUE}.} + + \item{ylab}{the y-axis label of the generated plot. Used if + \dQuote{to.plot} is \sQuote{TRUE}.} - \item{ylab}{If to.plot is \sQuote{TRUE}, then the plot generated will - take this Y label.} - - \item{main}{If to.plot is \sQuote{TRUE}, then the plot generated will - take this as the main title.} + \item{main}{main title of the plot. Used if \dQuote{to.plot} is + \sQuote{TRUE}.} } +%% FIXME: add \details section? + \value{A \sQuote{matrix} with 3 columns: the lower confidence interval (CI), the mean, and the upper CI which are the result of wilcox inference.} \author{Vikram Bahure} \seealso{ - phys2eventtime + \code{\link{phys2eventtime}} + \code{\link{inference.bootstrap}} } \examples{ From noreply at r-forge.r-project.org Mon Mar 31 20:23:50 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Mon, 31 Mar 2014 20:23:50 +0200 (CEST) Subject: [Eventstudies-commits] r267 - pkg/man Message-ID: <20140331182350.60C17186FFE@r-forge.r-project.org> Author: chiraganand Date: 2014-03-31 20:23:50 +0200 (Mon, 31 Mar 2014) New Revision: 267 Modified: pkg/man/lmAMM.Rd Log: Minor change in language, added lm in see also section. Modified: pkg/man/lmAMM.Rd =================================================================== --- pkg/man/lmAMM.Rd 2014-03-31 18:18:16 UTC (rev 266) +++ pkg/man/lmAMM.Rd 2014-03-31 18:23:50 UTC (rev 267) @@ -39,7 +39,7 @@ Function \sQuote{makeX} is used to prepare the explanatory variables (\dQuote{X}) used in the estimation of AMM. The first variable of \dQuote{X} is always the stock market index. Other variables could be - currency or bond returns, or other variables as desired by the user. + currency, bond returns, or other variables as required. If \dQuote{nlags} is \sQuote{NA} (default), then the function tries to find the best lag structure using the AIC. @@ -74,8 +74,8 @@ \author{Ajay Shah, Vimal Balasubramaniam} \seealso{ - \code{\link{makeX}} for preparing explanatory variables for - computation of Augmented Market Models used in this function. + \code{\link{makeX}} + \code{\link{lm}} } \examples{ From noreply at r-forge.r-project.org Mon Mar 31 20:31:48 2014 From: noreply at r-forge.r-project.org (noreply at r-forge.r-project.org) Date: Mon, 31 Mar 2014 20:31:48 +0200 (CEST) Subject: [Eventstudies-commits] r268 - pkg/man Message-ID: <20140331183148.A021A186DF3@r-forge.r-project.org> Author: chiraganand Date: 2014-03-31 20:31:48 +0200 (Mon, 31 Mar 2014) New Revision: 268 Modified: pkg/man/manyfirmssubperiod.lmAMM.Rd Log: Changed title, added fixme. Modified: pkg/man/manyfirmssubperiod.lmAMM.Rd =================================================================== --- pkg/man/manyfirmssubperiod.lmAMM.Rd 2014-03-31 18:23:50 UTC (rev 267) +++ pkg/man/manyfirmssubperiod.lmAMM.Rd 2014-03-31 18:31:48 UTC (rev 268) @@ -1,8 +1,7 @@ \name{manyfirmssubperiod.lmAMM} \alias{manyfirmssubperiod.lmAMM} -\title{A function to compute AMM for multiple firms across several -periods} +\title{Compute AMM for multiple firms across several periods} \description{This function runs AMM for multiple firms at once using the matrix of data obtained from \code{makeX}, and a matrix of LHS @@ -29,7 +28,7 @@ market model.} \item{dates}{a set of dates that mark out subperiods of interest. If - dates is NULL, then full period is considered.} + dates is \sQuote{NULL}, then full period is considered.} \item{periodnames}{a \sQuote{character} vector of names for each subperiod that has been marked by the \dQuote{dates} argument.} @@ -37,6 +36,11 @@ \item{verbose}{Whether to print detailed output. Default is \sQuote{FALSE}} } +%% FIXME: \details section! +%% steps: +%% - calculates exposures and SDS +%% - runs AMM for each subperiod for each firm + \section{Warning}{Do not have any space between names provided under \dQuote{periodnames}.}