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:

(10.1)maximizeμTxδ2xTΣxsubject to1Tx=1.

Assume that the vector of mean returns μ belongs to the elliptical uncertainty set

(10.2)Uμ={μ(μμ0)TQ1(μμ0)γ2},

where Q is a known positive semidefinite matrix. Then the worst case expected portfolio return will be

minμUμμTx=μ0TxγxTQx.

It follows that the robust version of (10.1) becomes

(10.3)maximizeμ0TxγxTQxδ2xTΣxsubject to1Tx=1.

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 Rt and factor return vector Ft at time t, the factor model takes the form

(10.4)Rt=μ+βFt+θt,

where μ is the vector of mean security returns, β is the factor loading matrix, and θt is the vector of residual returns. We also assume an exact factor model (see Sec. 5 (Factor models)), meaning that the factor returns and residual returns are assumed to be independent, and the residual covariance matrix D of θt is diagonal. Moreover, E(Ft)=0, so the factors carry no information on the mean returns. A final assumption in this section is that the factor covariance matrix QRK×K is known exactly. This requirement will be relaxed later.

The portfolio mean return and portfolio variance will be E(Rx)=μTx and Var(Rx)=xT(βQβT+D)x. If we compute estimates μ, β, and D of the above quantities, we can reformulate problem (2.1):

(10.5)minimizet1+t2subject toμTxrmin,xTDxt2,xTβQβTxt1,xF.

10.3.1 Uncertainty sets

Instead of computing (10.5) using estimates, we assume variables μ, β, and D to lie in the following uncertainty sets:

  • The diagonal elements σθ2 of the matrix D can take values in an uncertainty interval [σθ2,σθ2]:

    (10.6)UD={Ddiag(D)[σθ2,σθ2]}
  • The factor loadings matrix β belongs to the elliptical uncertainty set

    (10.7)Uβ={ββ=β0+B,BiGρi,i=1,,N}

    where Bi is row i of the matrix B, and bG=bTGb denotes the elliptic norm of b with respect to the positive definite matrix GRK×K.

  • The vector μ of mean returns is assumed to lie in the uncertainty interval

    (10.8)Uμ={μμ=μ0+m,|m|γ}

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:

(10.9)minimizet1+t2subject tominμUμμTxrmin,maxDUDxTDxt2,maxβUβxTβQβTxt1,xF.

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:

    minμUμμTx=μ0TxγT|x|.
  • We can evaluate the worst case residual portfolio variance:

    maxDUDxTDx=xTDiag(σθ2)x.
  • We cannot easily evaluate the worst case factor portfolio variance. But we can show that the constraint

    maxβUβxTβQβTxt1

    is equivalent to

    (10.10)(ρT|x|,t1,x)H(β0,Q,G).

    Relation (10.10) is a shorthand notation for the following: Define H=G1/2QG1/2, with spectral decomposition H=VΛVT, and define w=VTH1/2G1/2β0Tx. Then there exist τ,s,u0 that satisfy the set of conic constraints

    τ+1Tut1,s1/λmax(H),(ρT|x|)2sτ,wi2(1sλi)ui,i=1,,K

    There 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):

(10.11)minimizet1+t2subject toμ0TxγT|x|rmin,xTDiag(σθ2)xt2,(ρT|x|,t1,x)H(β0,Q,G),xF,

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):

(10.12)minimizet1+t2subject toμ0TxγTzrmin,(t2,12,σθ2x)QrN+2,(ρTz,t1,x)H(β0,Q,G),xz,xz,xF,

and the constraint (ρTz,t1,x)H(β0,Q,G) can be modeled using the hyperbolic constraint in Sec. 13.1.1.8 (Hyperbolic constraint):

(10.13)τ+1Tut1,s1/λmax(H),(s,τ,ρTz)Qr3,(1sλi,ui,wi)Qr3,i=1,,K

where τ,s,u0 are new variables, w=VTH1/2G1/2β0Tx, and λi are eigenvalues of H=G1/2QG1/2=VΛVT.

10.3.4 Case of unknown factor covariance

In this section we cover the case when the factor covariance matrix Q is also uncertain, and has the estimate Q. In this case, the robust portfolio optimization problem can still be converted into a conic form, and solved efficiently.

We can give an uncertainty structure to either the factor covariance matrix Q or its inverse Q1. Both choices lead to the same worst case portfolio variance constraint. The choice of Q1 is a bit more restrictive, but allows us to accomodate prior information about the structure of Q. See the details in [GI03]. Here we describe the case of Q.

The matrix estimate Q has the uncertainty structure

(10.14)UQ={QQ=Q0+Δ0,Δ=ΔT,N1/2ΔN1/2ζ},

where Q00, and the norm is the spectral norm or the Frobenius norm.

Then the worst case factor portfolio variance constraint

maxβUβ,QUQxTβQβTxt1

is equivalent to

(10.15)(ρT|x|,t1,x)H(β0,Q0+ζN,G).

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 μ, β, D are estimated from the security return and factor return data, using multivariate linear regression. We can also compute multidimensional confidence regions with any desired confidence level around the least-squares estimates. These confidence regions become the uncertainty sets in the robust portfolio optimization problem. The regression procedure also yields natural choices for the matrix G defining the elliptic norm and the bounds ρ, γ, σθ2. In [GI03], there are two methods discussed to construct the uncertainty sets from data, here we detail only one of them.

In (10.4) the factor model is written for all security at one time instant t. Now we write the model for one security i at all time instants:

Ri=μi+βiF+θi,i=1,,N

where βi is row number i of β. We can write this in a shorter form as

Ri=AYi+θi,i=1,,N

where Yi=[μi,βi]TR(K+1)×1, and A=[1,FT]RN×(K+1).

Assuming that the matrix A is rank K+1, and we have market return series ri, the theory of ordinary least squares leads to the estimate

y¯i=[μ¯i,β¯i]T=(ATA)1ATri

The ω elliptical confidence region around yi is then

Uyi(ω)={yi(y¯iyi)T(ATA)(y¯iyi)(K+1)(sθ2)icK+1(ω)},

where (sθ2)i=riAy¯i2/(TK1) is estimate of the error variance (σθ2)i, cK+1(ω) is the ω critical value, the solution of FF(cK+1)=ω, and FF is the CDF of the F-distribution with degrees of freedom (K+1,TK1).

Then the full ωN confidence set for y will be Uy(ω)=Uy1(ω)××UyN(ω).

10.4.1 The parameters of Uμ

If we project Uy(ω) along the vector μ, we get the ωN confidence set (10.8), where

(μ0)i=μ¯i,γi=(K+1)(ATA)1,11(sθ2)icK+1(ω)

10.4.2 The parameters of Uβ

Let P=[0,I]RK×(K+1) be the matrix projecting yi along βi. If we project Uy(ω) along β, then we get the ωN confidence set (10.7), where

(β0)i=β¯i,G=(P(ATA)1PT)1=FFT1T(F1)(F1)T,ρi=(K+1)(sθ2)icK+1(ω)

10.4.3 The parameters of UD

It would be natural to choose the confidence interval around (sθ2)i, the estimate of the error variance (σθ2)i, but we only have a single value. It would be possible to use bootstrapping to construnct an upper bound this way, but it can be computationally expensive.

Since we only require an estimate of the worst case error variance (σθ2)i for the robust optimization problem, it is cheaper to use any reasonable estimate for this purpose.

10.4.4 The parameters of UQ

In case the factor covariance matrix is not known, we can construct its uncerainty region also from data. According to [GI03], the ωK confidence set (10.14) can be parameterized the following way:

Q0=QML,N=QML,ζ=η/(1η),

where QML=G/(T1) is the maximum likelihood estimate (MLE) of Q computed from factor return data, and η is the unique solution of

(10.16)FΓ(1+η)FΓ(1η)=ω,

where FΓ is the CDF of a Γ(T+12,T12) random variable [1], and ω is the desired confidence level. [2] Note that equation (10.16) restricts ωK to be at most FΓ(2)K, which depends on the number of data samples T. However, this limitation is not very restrictive in practice. [3]

10.5 Example

Here we show a code example of the robust optimization problem (10.3), that we restate here:

(10.17)maximizeμ0TxγxTQxδ2xTΣxsubject to1Tx=1.

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 γxTQx, where γ controls the size of the uncertainty region. If γ=0, then we get back the original, non-robust MVO problem. The second quadratic expression δ2xTΣx models the portfolio risk, and δ is the risk aversion coefficient.

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 sq=xTQx, then the objective of the problem will be

# Objective
delta = M.parameter()
wc_return = x.T @ mu0 - gamma * sq
M.objective('obj', ObjectiveSense.Maximize, wc_return - delta * s)

Assuming that Q=GQGQT, the square root term can be modeled as

# Robustness
M.constraint('robustness', Expr.vstack(sq, GQ.T @ x), Domain.inQCone())

Similarly, we substitute the risk term with s=12xTΣx, and assuming Σ=GGT, we model the risk as

# 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.

_images/eff_frontier_robust.png

Fig. 10.1 The efficient frontier.

_images/portfolio_composition_robust.png

Fig. 10.2 Portfolio composition x with varying level if risk-aversion δ.

Footnotes