This function extracts residuals from a market model using
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.
a zoo time series object (univariate or otherwise) with firm returns.
a zoo time series of market index returns.
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.
Residual returns unexplained by market index returns.
Chirag Anand, Vikram Bahure
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.