fit.contribution: fit.contribution

Description Usage Arguments Value Author(s) References Examples

View source: R/fit.factor.models.R

Description

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).

Usage

1
fit.contribution(fit, bm.wgt.var, port.wgt.var)

Arguments

fit

list output from "fit.attribution"

bm.wgt.var

string name of benchmark weight column (in fitdata passed to "fit.attribution")

port.wgt.var

string name of portfolio weight column (in fitdata passed to "fit.attribution")

Value

An object with S3 class "fir.factor.models" containing:

returns a table of periodic returns

returns.table a table of aggregate and annualized returns

Author(s)

Roger J. Bos, roger.bos@gmail.com

References

David R Carino, Combining Attribution Effects Over Time, The Journal of Performance Measurement, pages 5 - 14.

Examples

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')

rogerjbos/fit.factor.models documentation built on July 23, 2020, 3:44 p.m.