Description Usage Arguments Value Author(s) References Examples
View source: R/fit.factor.models.R
Function to calculate factor returns for portfolio attribution analysis. The code has been adapted from the factorAnalyticsAddons package (Uthaisaad, 2017).
1 2 3 4 |
date.var |
string name of the date column |
id.var |
string name of the id column |
return.var |
string name of the return column |
weight.var |
string name of the weight column |
rob.stats |
logical |
full.resid.cov |
logical |
z.score |
logical |
resid.EWMA |
logical |
exposures.var |
vector of string name(s) of the column(s) to use as exposures (attributes) |
strReturns |
logical |
An object with S3 class "fir.factor.models" containing:
beta a matrix of security exposures for the last time period
factor.returns a matrix of factor returns by date
residuals a list of regression residuals by date
r2 a vector of regression R-squared values
factor.cov a matrix of factor variances / covariances
resid.cov a matrix of residual variances / covariances
return.cov a matrix of return variances / covariances
resid.var a vector of residual variances
call the function call
fitdata a data.table of data to use for attribution
exposure.vars a vector of string names of factors to use for attribution
weight.var = weight.var,
date.var a string name of the column with dates
return.var a string name of the column with returns
id.var a string name of the column with IDs
id.names a vector of security names or IDs
factor.names a vector of factor names
exposures.char the name of the grouping column, if applicable
time.periods a vector of the dates
Roger J. Bos, roger.bos@gmail.com
https://github.com/chindhanai/factorAnalyticsAddons
1 2 3 4 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.