portvol, mctr, cctr {PortRisk}R Documentation

Portfolio Volatility and Contribution to Total Volatility Risk (MCTR & CCTR)

Description

portvol computes portfolio volatility of a given portfolio for specific weight and time period. mctr & cctr computes the Marginal Contribution to Total Risk (MCTR) & Conditional Contribution to Total Risk (CCTR) for the given portfolio.

Usage

portvol(tickers, weights = rep(1,length(tickers)),
        start, end, data)

mctr(tickers, weights = rep(1,length(tickers)),
        start, end, data)

cctr(tickers, weights = rep(1,length(tickers)),
        start, end, data)

Arguments

tickers

A character vector of ticker names of companies in the portfolio.

weights

A numeric vector of weights assigned to the stocks corresponding to the ticker names in tickers. The sum of the weights need not to be 1 or 100 (in percentage). By default, equal weights to all the stocks are assigned (i.e., by rep(1, length(tickers))).

start

Start date in the format "yyyy-mm-dd".

end

End date in the format "yyyy-mm-dd".

data

A zoo object whose rownames are dates and colnames are ticker names of the companies. Values of the table corresponds to the daily returns of the stocks of corresponding ticker names.

Details

As any portfolio can be considered as bag of pp-many risky assets, it is important to figureout how these assets contributes to total volatility risk of the portfolio. We consider an investment period and suppose rjr_j denote return to source jj for the same period, where j=1,2,,pj = 1, 2,\ldots, p. The portfolio return over the period is

Rp=j=1pwjrjR_p = \sum_{j=1}^{p} w_j r_j

where wjw_j is the portfolio exposure to the asset jj, i.e., portfolio weight, such that wj0w_j \ge 0 and j=1pwj=1\sum_{j=1}^{p} w_j = 1. Portfolio manager determines the size of wjw_j at the beginning of the investment period. Portfolio volatility is defined as

σ=wTΣw\sigma = \sqrt{w^T \Sigma w}

where w=(w1,w2,,wp)w = (w_1, w_2,\ldots, w_p) and Σ\Sigma being the variance-covariance matrix of the assets in the portfolio. The weights (wjw_j) are the main switches of portfolio's total volatility. Therefore, it is important for a manager to quantify, the sensitivity of the portfolio's volatility with respect to small change in ww. This can be achieved by differentiating the portfolio volatility with respect to ww,

σw=1σΣw=ρ\frac{\partial \sigma}{\partial w} = \frac{1}{\sigma} \Sigma w = \rho

where ρ=(ρ1,ρ2,,ρp)\rho = (\rho_1, \rho_2,\ldots, \rho_p) is know as 'Marginal Contribution to Total Risk' (MCTR). Note that MCTR of asset ii is

ρi=1σj=1pσijwj.\rho_i = \frac{1}{\sigma} \sum_{j=1}^{p} \sigma_{ij} w_j.

The CCTR (aka. Conditional Contribution to Total Risk) is the amount that an asset add to total portfolio volatility. In other words, ξi=wiρi\xi_i = w_i \rho_i is the CCTR of asset ii, i.e.,

σ=i=1pwiρi.\sigma = \sum_{i=1}^{p} w_i \rho_i.

Therefore portfolio volatility can be viewed as weighted average of MCTR.

Value

portvol

A numeric value. Volatility of a given portfolio in percentage.

mctr

A named numeric vector of Marginal Contribution to Total Risk (MCTR) in percentage with names being the ticker names.

cctr

A named numeric vector of Conditional Contribution to Total Risk (CCTR) in percentage with names being the ticker names.

See Also

zoo

Examples

data(SnP500Returns)

# consider the portfolio containing the first 4 stocks
pf <- colnames(SnP500Returns)[1:4]

st <- "2013-01-01" # start date
en <- "2013-01-31" # end date

# suppose the amount of investments in the above stocks are
# $1,000, $2,000, $3,000 & $1,000 respectively
wt <- c(1000,2000,3000,1000) # weights

# portfolio volatility for the portfolio 'pf' with equal (default) weights
pv1 <- portvol(pf, start = st, end = en,
                data = SnP500Returns)

# portfolio volatility for the portfolio 'pf' with weights as 'wt'
pv2 <- portvol(pf, weights = wt, start = st, end = en,
                data = SnP500Returns)

# similarly,
# mctr for the portfolio 'pf' with weights as 'wt'
mc <- mctr(pf, weights = wt, start = st, end = en,
            data = SnP500Returns)

# cctr for the portfolio 'pf' with weights as 'wt'
cc <- cctr(pf, weights = wt, start = st, end = en,
            data = SnP500Returns)

sum(cc) == pv2
# note that, sum of the cctr values is the portfolio volatility

[Package PortRisk version 1.1.0 Index]