Description Usage Arguments Value Author(s) References Examples
View source: R/fit.factor.models.R
Helper function to show contributions nicely. The periodic contributions from attribution cannot be cummulated to longer time periods so the carino adjustment is made as per Carino (1999).
1 | fit.contribution(fit, bm.wgt.var, port.wgt.var)
|
fit |
list output from |
bm.wgt.var |
string name of benchmark weight column (in fitdata passed to |
port.wgt.var |
string name of portfolio weight column (in fitdata passed to |
An object with S3 class "fir.factor.models" containing:
returns a table of periodic returns
returns.table a table of aggregate and annualized returns
Roger J. Bos, roger.bos@gmail.com
David R Carino, Combining Attribution Effects Over Time, The Journal of Performance Measurement, pages 5 - 14.
1 2 3 4 5 6 7 8 9 | stock <- as.data.table(stock)
stock[TICKER %in% c('SUNW','ORCL','MSFT'), portfolioWeight := 1/3, by=DATE]
stock[is.na(portfolioWeight), portfolioWeight := 0]
stock[, benchmarkWeight := 1/.N, by=DATE]
fit <- fit.attribution(fitdata = stock, date.var = 'DATE', id.var = 'TICKER', return.var = 'RETURN',
weight.var = 'LOG.MARKETCAP', exposure.vars = c('NET.SALES','BOOK2MARKET','GICS.SECTOR'),
rob.stats = TRUE, full.resid.cov = FALSE, z.score = FALSE,
stdReturn = TRUE, resid.EWMA = TRUE)
cfit <-fit.contribution(fit, bm.wgt.var = 'benchmarkWeight', port.wgt.var = 'portfolioWeight')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.