marketModel: Extract residuals from a market model

Description Usage Arguments Value Author(s) Examples

View source: R/marketModel.R

Description

This function extracts residuals from a market model using function stats:lm. ‘na.exclude’ is passed as ‘na.action’ for ‘lm’. For more than one firm, the function merges “market.returns” with each element of “firm.returns” before passing to ‘lm’ so that rows of firms without ‘NA’s are not removed from the zoo object.

Usage

1
marketModel(firm.returns, market.returns, residuals = TRUE)

Arguments

firm.returns

a zoo time series object (univariate or otherwise) with firm returns.

market.returns

a zoo time series of market index returns.

residuals

a ‘logical’ indicating whether to return residuals or ‘lm’ object. When argument to the function includes the entire time series, returns are estimated using the entire data set and not just estimation period, value of residuals should be TRUE in such a case.

Value

Residual returns unexplained by market index returns.

Author(s)

Chirag Anand, Vikram Bahure

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
 
data("StockPriceReturns")
data("OtherReturns")

mm.result <- marketModel(firm.returns = StockPriceReturns,
                         market.returns = OtherReturns$NiftyIndex,
                         residuals = TRUE)

comparison <- merge(MarketModel = mm.result$Infosys,
                    Infosys = StockPriceReturns$Infosys,
                    NiftyIndex = OtherReturns$NiftyIndex,
                    all = FALSE)
plot(comparison)

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