Description Usage Arguments Value References Examples
View source: R/BL_post_distr.R
BL_post_distr computes posterior distribution in the Black-Litterman model starting from arbitrary prior distribution
given as a discrete time series dat
and using views_distr
– submitted by the user distribution of views.
1 2 3 |
dat |
Time series of returns data; dat = cbind(rr, pk), where rr is an array (time series) of market asset returns, for n returns and k assets it is an array with \dim(rr) = (n, k), pk is a vector of length n containing probabilities of returns. |
returns_freq |
Frequency of data in time series |
prior_type |
Type of distribution in time series |
market_portfolio |
Market portfolio – benchmark (equilibrium) portfolio (for details see Palczewski&Palczewski). |
SR |
Benchmark Sharpe ratio. |
P |
"Pick" matrix in the Black-Litterman model (see Palczewski&Palczewski). |
q |
Vector of investor's views on future returns in the Black-Litterman model (see Palczewski&Palczewski). |
tau |
Confidence parameter in the Black-Litterman model. |
risk |
Risk measure chosen for optimization; one of "CVAR", "DCVAR", "LSAD", "MAD", where "CVAR" <e2><80><93> denotes Conditional Value-at-Risk (CVaR), "DCVAR" <e2><80><93> denotes deviation CVaR, "LSAD" <e2><80><93> denotes Lower Semi Absolute Deviation, "MAD" <e2><80><93> denotes Mean Absolute Deviation. |
alpha |
Value of alpha quantile in the definition of risk measures CVAR and DCVAR. Can be any number when risk measure is parameter free. |
views_distr |
Distribution of views. An external function submitted by the user which computes densities of the distribution of views in given data points.
It is assumed implicitly that this distribution is an elliptical distribution (but any other distribution type can be used
provided calling to this function will preserve described below structure).
Call to that function has to be of the following form
|
views_cov_matrix_type |
Type of the covariance matrix of the distribution of views; can be: "diag" – diagonal part of the covariance matrix is used; "full" – the complete covariance matrix is used; (for details see Palczewski&Palczewski). |
cov_matrix |
Covariance matrix used for computation of market expected return ( |
post_distr | a time series of data for posterior distribution; for a time series of length n and k assets |
it is a matrix (n, k+1), where columns (1:k) contain return vectors and the last column | |
probabilities of returns. |
Palczewski, J., Palczewski, A., Black-Litterman Model for Continuous Distributions (2016). Available at SSRN: https://ssrn.com/abstract=2744621.
1 2 3 4 5 6 7 8 9 10 11 12 13 | library(mvtnorm)
k = 3
num =100
dat <- cbind(rmvnorm (n=num, mean = rep(0,k), sigma=diag(k)), matrix(1/num,num,1))
# a data sample with num rows and (k+1) columns for k assets;
returns_freq = 52 # we assume that data frequency is 1 week
w_m <- rep(1/k,k) # benchmark portfolio, a vector of length k,
SR = 0.5 # Sharpe ratio
Pe <- diag(k) # we assume that views are "absolute views"
qe <- rep(0.05, k) # user's opinions on future returns (views)
tau = 0.02
BL_post_distr(dat, returns_freq, NULL, w_m, SR, Pe, qe, tau, risk = "MAD", alpha = 0,
views_distr = observ_normal, "diag", cov_matrix = NULL)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.