This function solves the entropy minimization problem with equality and inequality constraints. The solution is a vector of posterior probabilities that distorts the least the prior (equal-weights probabilities) given the constraints (views on the market).
entropy_pooling( p, A =NULL, b =NULL, Aeq =NULL, beq =NULL, solver = c("nlminb","solnl","nloptr"),...)
Arguments
p: A vector of prior probabilities.
A: The linear inequality constraint (left-hand side).
b: The linear inequality constraint (right-hand side).
Aeq: The linear equality constraint (left-hand side).
beq: The linear equality constraint (right-hand side).
solver: A character. One of: "nlminb", "solnl" or "nloptr".
...: Further arguments passed to one of the solvers.
Returns
A vector of posterior probabilities.
Details
When imposing views constraints there is no need to specify the non-negativity constraint for probabilities, which is done automatically by entropy_pooling.
For the arguments accepted in ..., please see the documentation of nlminb, solnl, nloptr
and the examples bellow.
Examples
# setupret <- diff(log(EuStockMarkets))n <- nrow(ret)# View on expected returns (here is 2% for each asset)mean <- rep(0.02,4)# Prior probabilities (usually equal weight scheme)prior <- rep(1/ n, n)# Viewviews <- view_on_mean(x = ret, mean = mean)# Optimizationep <- entropy_pooling( p = prior, Aeq = views$Aeq, beq = views$beq, solver ="nlminb")ep
### Using the ... argument to control the optimization parameters# nlminbep <- entropy_pooling( p = prior, Aeq = views$Aeq, beq = views$beq, solver ="nlminb", control = list( eval.max =1000, iter.max =1000, trace =TRUE))ep
# nloptrep <- entropy_pooling( p = prior, Aeq = views$Aeq, beq = views$beq, solver ="nloptr", control = list( xtol_rel =1e-10, maxeval =1000, check_derivatives =TRUE))ep