Description Usage Arguments Details Author(s) See Also Examples
calculates Standard Deviation for univariate and multivariate series, also calculates component contribution to standard deviation of a portfolio
1 2 3 4 5 6 7 8 9 10 11 12 13 |
R |
a vector, matrix, data frame, timeSeries or zoo object of asset returns |
... |
any other passthru parameters |
clean |
method for data cleaning through |
portfolio_method |
one of "single","component" defining whether to do univariate/multivariate or component calc, see Details. |
weights |
portfolio weighting vector, default NULL, see Details |
mu |
If univariate, mu is the mean of the series. Otherwise mu is the vector of means of the return series , default NULL, , see Details |
sigma |
If univariate, sigma is the variance of the series. Otherwise sigma is the covariance matrix of the return series , default NULL, see Details |
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 |
method |
a character string indicating which correlation coefficient
(or covariance) is to be computed. One of |
SE |
TRUE/FALSE whether to ouput the standard errors of the estimates of the risk measures, default FALSE. |
SE.control |
Control parameters for the computation of standard errors. Should be done using the |
TODO add more details
This wrapper function provides fast matrix calculations for univariate, multivariate, and component contributions to Standard Deviation.
It is likely that the only one that requires much description is the component decomposition. This provides a weighted decomposition of the contribution each portfolio element makes to the univariate standard deviation of the whole portfolio.
Formally, this is the partial derivative of each univariate standard deviation with respect to the weights.
As with VaR
, this contribution is presented in two forms, both
a scalar form that adds up to the univariate standard deviation of the
portfolio, and a percentage contribution, which adds up to 100
as with any contribution calculation, contribution can be negative. This
indicates that the asset in question is a diversified to the overall
standard deviation of the portfolio, and increasing its weight in relation
to the rest of the portfolio would decrease the overall portfolio standard
deviation.
Brian G. Peterson and Kris Boudt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | if(!( Sys.info()[['sysname']]=="Windows") ){
# if on Windows, cut and paste this example
data(edhec)
# first do normal StdDev calc
StdDev(edhec)
# or the equivalent
StdDev(edhec, portfolio_method="single")
# now with outliers squished
StdDev(edhec, clean="boudt")
# add Component StdDev for the equal weighted portfolio
StdDev(edhec, clean="boudt", portfolio_method="component")
} # end CRAN Windows check
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.