In this article, we'll introduce key concepts of risk and return related to portfolio construction and portfolio analysis.

In particular, we'll discuss several risk and performance measures that are used in portfolio management and analysis, including risk measures such as Value-at-Risk, Conditional Value-at-Risk, and more.

This article is based on notes from the first course in this Investment Management with Python and Machine Learning Specialization and is organized as follows:

- Fundamentals of Returns
- Measuring Risk and Reward
- Deviations from Normality
- Downside Risk Measures
- Estimating VaR

If you're interested in learning more about machine learning for trading and investing, check out our AI investment research platform: the MLQ app.

The platform combines fundamentals, alternative data, and ML-based insights.

You can learn more about the MLQ app here or sign up for a free account here.

*This post may contain affiliate links. See our **policy page** for more information.*

## Fundamentals of Returns

To start, we'll first define define and characterize investment risk and returns.

The return of an asset is defined as follows:

$$R_{t, t+1} = \frac{P_{t+1} - P_t}{P_t}$$

If there were dividends paid during this period, they should be also added to $P_{t+1}$ in order to get the total return, otherwise it is known as the price return.

### Multiperiod Returns

If we have multiple time periods, for example $t_0$ to $t_1$ and $T_0$ to $T_1$, the return over the combine time frame can be calculated as follows:

$$R_{t, t+2} = (1 + R_{t, t+1})(1+R_{t+1, t+2}) - 1$$

This formula provides the compounded return over the two time periods.

### Annualizing Returns

In order to compare monthly returns with quarterly or daily returns, we need to annualize the returns. For example, a monthly return can be annualized with following formula:

$$((1 + R)^{12} - 1)$$

### Stay up to date with AI

## Measuring Risk and Reward

The first thing to note about returns is that average returns are not a good way to analyze overall returns as they fail to take into volatility.

Volatility can be formally measured using the standard deviation and variance of returns.

In order to get the **variance **of returns, we compute the average of the square of the deviations from the mean:

$$\sigma^2_R = \frac{1}{N}\sum^N_{i=1}(R_1 - \bar{R})^2$$

where:

- $\bar{R}$ is the arithmetic mean of the returns

Since the variance is the average of the squares of returns, it makes it difficult to compare returns themselves.

To deal with this, we take the square root of the variance in order to get the **standard deviation **of returns:

$$\sigma_R = \sqrt{\frac{1}{N}\sum^N_{i=1}(R_1 - \bar{R})^2}$$

Now that we have a measure of volatility, we need to be able to annualize it since we can't compare volatility from daily data to monthly data, for example.

In order to annualize volatility for daily data, we multiply the daily volatility by the square root of the number of trading days per year, or 252:

$$\sigma_ann = \sigma_p\sqrt{p}$

### Risk Adjusted Measures

Now that we have a basic measurement of risk, we can compare risk-adjusted returns.

One way to compare risk-adjusted returns is to look at the excess return over the risk-free rate, otherwise known as the Sharpe ratio:

$$Sharpe(P) = \frac{R_p - R_f}{\sigma^p}$$

### Measuring Max Drawdown

Another commonly used risk metric that is different from volatility is the maximum drawdown.

Max drawdown is simply the maximum loss from the previous high to the subsequent low.

A common risk metric associated with max drawdown is the Calmar ratio, which is defined as the ratio of the annualized returns over the trailing 36 months to the max drawdown over those 36 months.

## Deviations from Normality

In this section, we'll look at deviations from normality, or how time series returns are typically not normally distributed. Instead, normal distribution is an simplifying assumption.

When we assume a normal distribution in returns, there's a very small probability that the returns will take on very positive or negative returns.

In reality, however, we find that the normal distribution underestimates the magnitude of extreme returns.

In order to account for this, we should move beyond the mean and variance and look at higher order moments.** **In particular, we should look at **skewness** and **kurtosis**:

Skewness** **is a measure of asymmetry of the distribution and can be calculated as follows:

$$S(R) = \frac{E[(R - E(R))^3]}{[Var(R)]^{3/2}}$$

Kurtosis is a measure of the thickness of the tail of the distribution. Gaussian distribution has very thin tails that decreases sharply to zero, although as mentioned, these tails tend to be fatter than normal distribution in reality.

Kurtosis can be calculated as follows:

$$K(R) = \frac{E[(R - E(R))^4]}{[Var(R)]^2}$$

Any return distribution that has a kurtosis higher than 3 is considered a fat tail distribution.

## Downside Risk Measures

In this section, we'll discuss several downside risk measurements. In particular, we want to go beyond volatility as it is a very symmetric measurement that tells us about the average risk.

Instead, we want to understand measurements for more extreme deviations around the mean.

### Semi-Deviation

The first risk metric is called **semi-deviation** or **semi-volatility**, which is the volatility of the sub-sample of below-average or below-zero returns.

Semi-deviation can be calculated as follows:

$$\sigma_{semi} = \sqrt{\frac{1}{N}\sum_{R_t\leq\bar{R}}(R_t - \bar{R})^2}$$

where:

- $N$ is the number of returns that fall below the mean

### Value at Risk (VaR)

Another useful risk metric is Value at Risk (VaR), which represents the maximum "expected" loss over a given time period.

To calculate VaR, we first define a specified confidence level, for example 99%, and the time period that we're looking at, let's say over 1 month.

We'll discuss several methods for estimating VaR more below.

### Conditional Value at Risk (CVaR)

A similar risk metric is called Conditional Value at Risk (CVaR)**,** which is defined as the expected loss beyond VaR and is calculated as follows:

$$CVaR = -E(R|R \leq -VaR) = \frac{\int_{-\infty}^{-VaR} x \cdot f_R(x)dx}{F_R(-VaR)}$$

## Estimating VaR

In this section, we'll discuss different methodologies for estimating VaR.

There are at least four standard methods for calculating VaR:

- Historical (non-parametric)
- Variance-Covariance (parametric gaussian)
- Parametric non-gaussian
- Cornish-Fisher (semi-parametric)

Each method has its pros and cons, so in statistical analysis it is about choosing the most suitable method for that particular context.

### Historical VaR

Historical VaR is a calculation of VaR based on the distribution of historical changes in the value of the current portfolio under market prices over the specified historical observation window.

Historical VaR is calculated as follows:

$$VaR = v_m \frac{v_i}{v_{i-1}}$$

where:

- $v_i$ is the number of variables on day $i$
- $m$ is the number of days from which historical data is taken

The advantage of this method is that you're not making assumptions about asset return distributions.

The drawback of this method is that since we're not making any assumptions, we're relying solely on historical data. This means the estimate may be sensitive to the sample period.

### Parametric Gaussian Methodology

The parametric gaussian methodology is a competing method that calculates VaR based on **portfolio volatility**, in other words on volatilities and correlations of components.

The benefit of assuming a Gaussian distribution with this method is that you only need to estimate the mean and volatility of the distribution.

The risk of assuming normality, however, is that it may underestimate risk.

### Parametric Non-Gaussian VaR

The parametric non-Gaussian VaR attempts to solve this issue of underestimating risk.

Parametric non-Gaussian VaR can be useful as it mitigates the problem of estimation risk at the cost of model risk.

### Cornish-Fisher VaR

The Cornish-Fisher VaR is an alternative to parametric model that is a semi-parametric approach.

This approach does not force you to assume any return distribution, and thus it can be useful in a non-Gaussian setting.

## Summary: Measuring Risk in Portfolio Analysis

In summary, there are several ways to measure risk in portfolio analysis. The most common measurement is standard deviation, which assumes a normal distribution of returns.

In practice, however, this Gaussian distribution tends to underestimate the potential for extreme returns, either positive or negative. Going beyond standard deviation, several other risk measures include VaR and conditional VaR.

There are several methods for estimating VaR, including:

- Historical (non-parametric)
- Variance-Covariance (parametric gaussian)
- Parametric non-gaussian
- Cornish-Fisher (semi-parametric)

Each of these methods have their advantages and disadvantages, although at the end of the day there is a trade-off between sample risk and model risk.