Description Usage Arguments Details Value Note See Also Examples
View source: R/risk.attribution.R
Combined representation of the risk attributes MCTR, CCTR, CCTR percentage, Portfolio Volatility and individual Volatility of the stocks in a given portfolio for a given weight and time period.
1 2 |
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 |
start |
Start date in the format "yyyy-mm-dd". |
end |
End date in the format "yyyy-mm-dd". |
data |
A |
CompanyList |
A dataframe containing all the Company names corresponding to the ticker names as its |
For details of the risk attributes refer to the corresponding functions. See volatility
for individual volatility of the stocks and portvol
for portfolio volatility, MCTR & CCTR.
CCTR percentage for a stock in the portfolio is defined as the percentage of the portfolio volatility contributed by that stock for the given weight. i.e.,
CCTR(%) = CCTR/σ *100
where σ is the portfolio volatility.
Returns a dataframe with rownames
as the ticker names as given in the input tickers
with the last row corresponding to the portfolio values. The result contains the following columns:
Company Name |
Optional. Available only if the dataframe with the company names corresponding to the ticker names as |
Weight |
Standardized value of the weights assigned to the stocks in the portfolio. Value of this column corresponding to portfolio is the sum of the weights (i.e. 1). |
MCTR |
Marginal Contribution to Total Risk (MCTR) in percentage. MCTR corresponding to the portfolio will be shown as |
CCTR |
Conditional Contribution to Total Risk (CCTR) in percentage. CCTR corresponding to the portfolio is the sum of the CCTR values, which is the portfolio volatility. |
CCTR(%) |
Percentage of the portfolio volatility contributed by the stock for the given weight. Clearly, CCTR percentage corresponding to the portfolio is 100. |
Volatility |
Individual volatility of the stocks in percentage. Note that, the value of this column corresponding to the portfolio is not the sum of this column. It is the portfolio volatility. |
In the result or output (see example), both the values of the last row (Portfolio) corresponding to the columns CCTR and Volatility are same (Portfolio Volatility). It should also be noted that, Portfolio Volatility is the sum of CCTR values corresponding to all the stocks but not the sum of individual Volatility of the stocks.
volatility
,
portvol
,
mctr
,
cctr
,
zoo
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # load the data 'SnP500Returns'
data(SnP500Returns)
# consider the portfolio containing the stocks of the companies
# Apple, IBM, Intel, Microsoft
pf <- c("AAPL","IBM","INTC","MSFT")
# suppose the amount of investments in the above stocks are
# $10,000, $40,000, $20,000 & $30,000 respectively
wt <- c(10000,40000,20000,30000) # weights
# risk attribution for the portfolio 'pf' with weights 'wt'
# for the time period January 1, 2013 - January 31, 2013
risk.attribution(tickers = pf, weights = wt,
start = "2013-01-01", end = "2013-01-31",
data = SnP500Returns)
# to attach the company names corresponding to the ticker names
# load the dataset containing the company names
data(SnP500List)
risk.attribution(tickers = pf, weights = wt,
start = "2013-01-01", end = "2013-01-31",
data = SnP500Returns, CompanyList = SnP500List)
|
Weight MCTR CCTR CCTR(%) Volatility
AAPL 0.1 2.0614388 0.2061439 18.80638 3.505336
IBM 0.4 0.9297546 0.3719018 33.92837 1.169305
INTC 0.2 1.2062182 0.2412436 22.00851 1.948613
MSFT 0.3 0.9228293 0.2768488 25.25674 1.194353
Portfolio 1.0 NA 1.0961382 100.00000 1.096138
Company Name Weight MCTR CCTR CCTR(%)
AAPL Apple Inc. 0.1 2.0614388 0.2061439 18.80638
IBM International Bus. Machines 0.4 0.9297546 0.3719018 33.92837
INTC Intel Corp. 0.2 1.2062182 0.2412436 22.00851
MSFT Microsoft Corp. 0.3 0.9228293 0.2768488 25.25674
Portfolio 1.0 NA 1.0961382 100.00000
Volatility
AAPL 3.505336
IBM 1.169305
INTC 1.948613
MSFT 1.194353
Portfolio 1.096138
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.