Description Usage Arguments Value Author(s) See Also Examples
View source: R/portVolDecomp.R
Decompose portfolio variance risk into factor/residual risk
1 2 3 4 5 6 7 8 | portVolDecomp(object, ...)
## S3 method for class 'tsfm'
portVolDecomp(object, weights = NULL, factor.cov,
use = "pairwise.complete.obs", ...)
## S3 method for class 'ffm'
portVolDecomp(object, weights = NULL, factor.cov, ...)
|
object |
fit object of class |
... |
optional arguments passed to |
weights |
a vector of weights of the assets in the portfolio. Default is NULL, in which case an equal weights will be used. |
factor.cov |
optional user specified factor covariance matrix with named columns; defaults to the sample covariance matrix. |
use |
an optional character string giving a method for computing covariances in the presence of missing values. This must be (an abbreviation of) one of the strings "everything", "all.obs", "complete.obs", "na.or.complete", or "pairwise.complete.obs". Default is "pairwise.complete.obs". |
A vector containing: percent factor contribution to risk portfolio volatility risk, factor volatility risk and residual/specific volatility risk
Douglas Martin, Lingjie Yi
fitTsfm
, fitFfm
for the different factor model fitting functions.
portSdDecomp
for portfolio factor model VaR decomposition.
portVaRDecomp
for portfolio factor model VaR decomposition.
portEsDecomp
for portfolio factor model ES decomposition.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | # Time Series Factor Model
data(managers)
fit.macro <- factorAnalytics::fitTsfm(asset.names=colnames(managers[,(1:6)]),
factor.names=colnames(managers[,(7:9)]),
rf.name=colnames(managers[,10]), data=managers)
decomp <- portVolDecomp(fit.macro)
decomp
# Fundamental Factor Model
data("stocks145scores6")
dat = stocks145scores6
dat$DATE = as.yearmon(dat$DATE)
dat = dat[dat$DATE >=as.yearmon("2008-01-01") &
dat$DATE <= as.yearmon("2012-12-31"),]
# Load long-only GMV weights for the return data
data("wtsStocks145GmvLo")
wtsStocks145GmvLo = round(wtsStocks145GmvLo,5)
# fit a fundamental factor model
fit.cross <- fitFfm(data = dat,
exposure.vars = c("SECTOR","ROE","BP","MOM121","SIZE","VOL121",
"EP"),date.var = "DATE", ret.var = "RETURN", asset.var = "TICKER",
fit.method="WLS", z.score = "crossSection")
decomp = portVolDecomp(fit.cross)
# get the factor contributions of risk
decomp
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.