makeX: Prepare regressors for computation of Augmented Market Models

Description Usage Arguments Details Value Warning Author(s) Examples

View source: R/lmAMM.R

Description

‘makeX’ is used to prepare regressors 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

1
2
3
4
5
6
7
makeX(market.returns,
      others,
      switch.to.innov = rep(TRUE, NCOL(others)),
      market.returns.purge = TRUE,
      nlags = 5,
      dates = NULL,
      verbose = FALSE)

Arguments

market.returns

a univariate timeseries object of ‘class’ zoo. In market models, this is normally the returns of a stock market index.

others

a zoo matrix of other regressors for the multiple regression model.

switch.to.innov

a ‘logical’ vector with an element for each column in “others” specifying whether to switch the column from raw values to auto-regressive residuals. Default is ‘TRUE’ for all the columns. See ‘Details’.

market.returns.purge

a ‘logical’ indicating whether to purge the effects of “others” from “market.returns”. See ‘Details’.

nlags

a integer specifying the number of lags required when ‘market.returns.purge’ is ‘TRUE’.

dates

a ‘Date’ vector, default set to ‘NULL’, specifying breaks. See ‘Details’.

verbose

a ‘logical’ value, with the default being ‘FALSE’, specifying whether detailed output is required.

Details

This function prepares the regressors of interest for the purpose of running aumgmented market models.

The ‘logical’ vector ‘switch.to.innov’ is applicable only to the regressors in ‘others’ matrix and not to the time series vector in ‘market.returns’.

When ‘market.returns.purge’ is ‘TRUE’, residuals from a regression of ‘market.returns’ on ‘others’ is obtained. If ‘dates’ are provided, this regression is done within sub-periods as identified by the ‘dates’ vector. When ‘dates’ is set to default value of ‘NULL’, the start and end points of ‘market.returns’ is taken as the period for estimation.

Value

a time-series object of regressors is returned.

Warning

The input data should not contain ‘NA’s, as is required by the “lm” function to estimate a linear regression. Please use ‘na.omit’ before feeding data into this function.

Author(s)

Ajay Shah, Chirag Anand, Vikram Bahure, Vimal Balasubramaniam

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
data("OtherReturns")
market.returns <- OtherReturns$NiftyIndex
currency.returns <- OtherReturns$USDINR

X <- makeX(market.returns,
           others = currency.returns,
           switch.to.innov = FALSE,
           market.returns.purge = FALSE,
           verbose = FALSE)
head(na.omit(X))

Example output

Loading required package: zoo

Attaching package:zooThe following objects are masked frompackage:base:

    as.Date, as.Date.numeric

Loading required package: xts
           market.returns           z
2010-07-01    -1.15678265  0.30097847
2010-07-02    -0.27267977  0.00000000
2010-07-05    -0.02291607  0.40702721
2010-07-06     1.00998963 -0.01069004
2010-07-07    -0.91072457  0.53310725
2010-07-08     1.05809043 -0.34726333

eventstudies documentation built on July 1, 2020, 10:26 p.m.