10 Robust optimization¶
In chapter Sec. 4 (Dealing with estimation error) we have discussed in detail, that the inaccurate or uncertain input parameters of a portfolio optimization problem can result in wrong optimal solutions. In other words, the solution is very input sensitive. Robust optimization is another possible modeling tool to overcome this sensitivity. It is a way of handling estimation errors in the optimization problem instead of the input preparation phase. In the most common setup, the parameters are the estimated mean and estimated covariance matrix of the security returns. In robust optimization, we do not compute point estimates of these, but rather an uncertainty set, where the true values lie with certain confidence. A robust portfolio thus optimizes the worst-case performance with respect to all possible parameter values within their corresponding uncertainty sets. [CJPT18, VD09]
10.1 Types of uncertainty¶
We can form different types of uncertainty sets around the unknown parameters, depending on the nature of the uncertainty, the sensitivity of the solution, and the available information.
Polytope: If we have a finite number of scenarios, we can form a polytope uncertainty set by taking the convex hull of the scenarios.
Interval: We can compute a confidence interval for each of the parameters.
Ellipsoidal region: For vector variables, we can compute confidence regions.
We can model all of these types of uncertainty sets in conic optimization, allowing us to solve robust optimization problems efficiently.
The size of the uncertainty sets reflects the desired level of robustness. For confidence intervals, it is controlled by the confidence level. There is of course a tradeoff, if the uncertainty sets are chosen to be very large, then the resulting portfolios will be very conservative, and they will perform much worse for any given parameter set, than the portfolio designed for that set of parameters. On the other hand, if the size is chosen too small, the resulting portfolio will not be robust enough.
10.2 Uncertainty in security returns¶
Consider problem (2.3), which we restate here:
Assume that the vector of mean returns
where
It follows that the robust version of (10.1) becomes
10.3 Uncertainty in the factor model¶
In the article [GI03], the authors consider a factor model on security returns, treat its parameters as uncertain using ellipsoidal uncertainty sets defined as confidence regions, and formulate robust portfolio optimization problems.
Assume that for a random security return vector
where
The portfolio mean return and portfolio variance will be
10.3.1 Uncertainty sets¶
Instead of computing (10.5) using estimates, we assume variables
The diagonal elements
of the matrix can take values in an uncertainty interval :(10.6)¶The factor loadings matrix
belongs to the elliptical uncertainty set(10.7)¶where
is row of the matrix , and denotes the elliptic norm of with respect to the positive definite matrix .The vector
of mean returns is assumed to lie in the uncertainty interval(10.8)¶
10.3.2 Robust problem formulation¶
The goal of robust portfolio selection is then to select portfolios that perform well for all parameter values that constitute these sets of uncertainty. In other words, we are looking for worst case optimal solutions, formulated as minmax optimization problems. Then we can state the robust mean-variance optimization problem:
To convert the minmax problem (10.9) into a conic optimization problem, we first need to represent the worst case expected portfolio return and portfolio variance using conic constraints:
We can evaluate the worst case expected portfolio return:
We can evaluate the worst case residual portfolio variance:
We cannot easily evaluate the worst case factor portfolio variance. But we can show that the constraint
is equivalent to
(10.10)¶Relation (10.10) is a shorthand notation for the following: Define
, with spectral decomposition , and define . Then there exist that satisfy the set of conic constraintsThere is also a different but equivalent version of this statement, see [GI03].
10.3.3 Robust conic model¶
Now we can formulate the robust optimization problem (10.9):
Finally, we can convert (10.11) into conic form by modeling the absolute value based on Sec. 13.1.1.3 (Absolute value) and the quadratic cone based on Sec. 13.1.1.10 (Quadratic form):
and the constraint
where
10.3.4 Case of unknown factor covariance¶
In this section we cover the case when the factor covariance matrix
We can give an uncertainty structure to either the factor covariance matrix
The matrix estimate
where
Then the worst case factor portfolio variance constraint
is equivalent to
10.4 Parameters¶
In this section we discuss how the parameters of the uncertainty sets introduced in Sec. 10.3.1 (Uncertainty sets) can be computed from market data. Typically the parameters
In (10.4) the factor model is written for all security at one time instant
where
where
Assuming that the matrix
The
where
Then the full
10.4.1 The parameters of ¶
If we project
10.4.2 The parameters of ¶
Let
10.4.3 The parameters of ¶
It would be natural to choose the confidence interval around
Since we only require an estimate of the worst case error variance
10.4.4 The parameters of ¶
In case the factor covariance matrix is not known, we can construct its uncerainty region also from data. According to [GI03], the
where
where
10.5 Example¶
Here we show a code example of the robust optimization problem (10.3), that we restate here:
We start at the point where data is already prepared, and we show the optimization model. This example considers an elliptical uncertainty region around the expected return vector. If we compute the worst case portfolio return in this case, there will be two terms with quadratic expressions. The first will be
We can model both terms using the second-order cones. For the term with square-root, the quadratic cone is more appropriate, while the portfolio variance term can be modeled using the rotated quadratic cone. We substitute the square-root term with the new variable
# Objective
delta = M.parameter()
wc_return = x.T @ mu0 - gamma * sq
M.objective('obj', ObjectiveSense.Maximize, wc_return - delta * s)
Assuming that
# Robustness
M.constraint('robustness', Expr.vstack(sq, GQ.T @ x), Domain.inQCone())
Similarly, we substitute the risk term with
# Risk constraint
M.constraint('risk', Expr.vstack(s, 1, G.T @ x),
Domain.inRotatedQCone())
The full model would look like the following:
with Model("Robust") as M:
# Variables
# The variable x is the fraction of holdings in each security.
# It is restricted to be positive, which imposes no short-selling.
x = M.variable("x", N, Domain.greaterThan(0.0))
# The variable s models the portfolio risk term.
s = M.variable("s", 1, Domain.greaterThan(0.0))
# The variable sq models the robustness term.
sq = M.variable("sq", 1, Domain.greaterThan(0.0))
# Budget constraint
M.constraint('budget', Expr.sum(x) == 1.0)
# Objective
delta = M.parameter()
wc_return = x.T @ mu0 - gamma * sq
M.objective('obj', ObjectiveSense.Maximize, wc_return - delta * s)
# Robustness
M.constraint('robustness', Expr.vstack(sq, GQ.T @ x), Domain.inQCone())
# Risk constraint
M.constraint('risk', Expr.vstack(s, 1, G.T @ x),
Domain.inRotatedQCone())
# Create DataFrame to store the results. Last security names
# (the factors) are removed.
columns = ["delta", "obj", "return", "risk"] + \
df_prices.columns.tolist()
df_result = pd.DataFrame(columns=columns)
for d in deltas:
# Update parameter
delta.setValue(d)
# Solve optimization
M.solve()
# Save results
portfolio_return = mu0 @ x.level() - gamma * sq.level()[0]
portfolio_risk = np.sqrt(2 * s.level()[0])
row = pd.Series([d, M.primalObjValue(),
portfolio_return, portfolio_risk] + \
list(x.level()), index=columns)
df_result = df_result.append(row, ignore_index=True)
Finally, we compute the efficient frontier in the following points:
deltas = np.logspace(start=-1, stop=2, num=20)[::-1]
If we plot the efficient frontier on Fig. 10.1, and the portfolio composition on Fig. 10.2 we can compare the results obtained with and without using robust optimization.

Fig. 10.1 The efficient frontier.¶

Fig. 10.2 Portfolio composition
Footnotes