assetDecomp: Decompose portfolio risk into individual asset contributions...

View source: R/assetDecomp.R

assetDecompR Documentation

Decompose portfolio risk into individual asset contributions and provide tabular report

Description

Compute the asset contributions to Sd, VaR and ES of returns based on Euler's theorem

Usage

assetDecomp(object, weights = NULL, rm, p, type = c("np", "normal"), ...)

Arguments

object

fit object of class tsfm, or ffm.

weights

vector of weights of the assets in the portfolio. Default is NULL, in which case an equal weights will be used.

rm

one of "Sd" (Standard Deviation) or "VaR" (Value at Risk) or "ES" (Expected Shortfall)

p

tail probability for calculation. Default is 0.05.

type

one of "np" (non-parametric) or "normal". Default is "np".

...

other optional arguments

Value

Risk Decomposition report for every asset in the portfolio

Author(s)

Avinash Acharya

References

Epperlein and Smillie (2006) "Cracking VAR with Kernels" Risk.net

See Also

riskDecomp for the Risk Decomposition function based on factors in the fitted model.

Examples

# Fundamental Factor Model
data("factorDataSetDjia5Yrs")
data("wtsDjiaGmvLo")

# fit a fundamental factor model
exposure.vars <- c("P2B", "MKTCAP")
fit <- fitFfm(data=factorDataSetDjia5Yrs, asset.var="TICKER", ret.var="RETURN", 
                date.var="DATE", exposure.vars=exposure.vars, z.score = "crossSection")
                
#non-parametric 
weights = wtsDjiaGmvLo               
sd.decomp = assetDecomp(fit, weights, rm = "Sd")
VaR.decomp = assetDecomp(fit, weights, rm = "VaR", p = 0.05)
ES.decomp = assetDecomp(fit, weights, rm = "ES", p = 0.05)                 

#normal dist
VaR.decomp = assetDecomp(fit, weights, rm = "VaR", p = 0.05, type = "normal")
ES.decomp = assetDecomp(fit, weights, rm = "ES", p = 0.05, type = "normal") 

braverock/factorAnalytics documentation built on Dec. 16, 2024, 1:05 p.m.