liveBook · Manning

Risk-aversion parameter

As explained in Build a Robo-Advisor with Python (From Scratch)

A risk-aversion parameter is a coefficient in an investment objective that controls the penalty assigned to portfolio risk relative to expected return.

A risk-aversion parameter, written as λ, controls how strongly portfolio variance is penalized relative to expected return. In the unconstrained mean-variance objective, the goal is to maximize μᵀw − (λ/2)wᵀΣw. section 11.1.3

The parameter has three practical effects in the stated model:

  • Determines the closed-form optimum w* = (1/λ)Σ⁻¹μ. section 11.1.3
  • Scales the portfolio up or down without changing relative weights when expected returns are proportional to asset volatilities and the covariance matrix is diagonal. section 11.1.3
  • Maps a reference portfolio and covariance matrix to reverse-optimized expected returns through μ = λΣp. section 12.1.1

Two-asset risk-parity calculation

A numerical calculation sets λ to 4.0 and γ to 0.3, builds a diagonal covariance matrix and implied expected returns, then computes optimal weights and each asset’s risk contribution. section 11.1.3

Listing 11.2 Risk contributions of a two-asset risk-parity portfolio
lamb = 4.0
gamma = 0.3
sigma = np.array([[0.0287, 0], [0, 0.0017]])
mu = gamma * np.sqrt(np.diag(sigma))

w_star = 1.0 / lamb * np.matrix(sigma).I @ mu
w_star = np.asarray(w_star).flatten()

w_var = w_star @ sigma @ w_star     
risk_contribs = np.diag(w_star) @ sigma @ w_star / w_var
risk_contribs

Inspect the NumPy listing that calculates optimal weights and risk contributions for the two-asset example. section 11.1.3

def compute_equilibrium_ers(weights, sigma, risk_aversion):  #1
    return risk_aversion * sigma @ weights    

Inspect the compact Python function that computes reverse-optimized expected returns from weights, covariance, and risk aversion. section 12.1.1

How Build a Robo-Advisor with Python (From Scratch) covers it

How deep it goes
Defines λ, derives closed-form weights, and applies covariance multiplication for reverse optimization, without developing additional constraints.
Examples
Uses a two-asset NumPy calculation with diagonal covariance, implied returns, optimal weights, and risk contributions.
What you can do after
Apply it via closed-form portfolio weights or compute reverse-optimized expected returns with a short Python function.
How it connects
Connects risk aversion with mean-variance optimization, covariance matrices, portfolio volatility, risk parity, and reverse optimization.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build a Robo-Advisor with Python (From Scratch). The section links point to the parts of the book it draws on.