portVolDecomp: Decompose portfolio variance risk into factor/residual risk

Description Usage Arguments Value Author(s) See Also Examples

View source: R/portVolDecomp.R

Description

Decompose portfolio variance risk into factor/residual risk

Usage

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

Arguments

object

fit object of class tsfm, or ffm.

...

optional arguments passed to cov.

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

Value

A vector containing: percent factor contribution to risk portfolio volatility risk, factor volatility risk and residual/specific volatility risk

Author(s)

Douglas Martin, Lingjie Yi

See Also

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.

Examples

 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             
 

sangeeuw/factorAnalytics documentation built on May 28, 2019, 3:40 p.m.