Skip to content
All library documents

Calculating Realized Variance from WTI Returns

Article Quant Q&A · Author: theo1996

Summary

The document corrects a mistaken approach to measuring realized variance in WTI. Taking the cumulative sum of log returns and then its absolute value tracks the magnitude of net price movement, not variance; positive and negative returns can cancel before the absolute value is applied.

For realized variance, square each log return and sum the squared values over the period. The response also offers the sum of absolute returns as an alternative measure of activity when squared returns are not suitable. These methods produce a nonzero floor in periods with price movement, unlike the absolute cumulative return, which can fall to zero when returns offset one another. The discussion is brief and gives no formal derivation, data comparison, or treatment of rolling windows, annualization, or the separate positive and negative semivariance measures mentioned in the question.

Key ideas

  • Cumulative returns followed by an absolute value measure net movement rather than realized variance.
  • Realized variance is calculated by summing squared log returns.
  • Summing absolute returns avoids cancellation between positive and negative returns, though it is not variance.
  • The choice of aggregation changes whether offsetting price moves can reduce the resulting measure to zero.

Tags

Full text
# How to properly calcualte Realized Variance for WTI?


# How to properly calcualte Realized Variance for WTI?












I have several realized variances for WTI, RV, scaledRV, RSVN(negative) and RSVP(positive), which were given to me by a professor whom I cant contact anymore. When I try to calculate my own RV (in eviews)first getting the log difference returns(@dlog(wti)) then multiplying that by 100 getting the cumulative sum and then taking the absolutes of cumsum

```
series wtiRV = @abs(@cumsum(@dlog(wti)*100))
```

Does anyone have a clue as to why this 2 graphs are different? I get this graph:

which is the closest to what the professor made: EDIT: @newquant mentioned using ∑|r| or squared log returns but they both dont make a graph similar to the professor's.

```
series wtiRV =@cumsum(@dlog(wti)^2)
series wtiRV =@cumsum(@abs(@dlog(wti)))
```

10day @mav 30day @mav

```
series wtiRV =@dlog(wti)^2
```

daily RV (even if multiplied by 100, as people usually do ,doesnt do it)

## Answer by Newquant (score 2, accepted)

https://quant.stackexchange.com/a/80168

That calculation doesn't seem correct to calculate realised variance.

Summing the log returns isn't going to give you a variance, it'll be something like an expected return, which you are then taking the absolute of afterwards.

You need to sum the squared log returns to give you a variance figure or, if you can't do that, then you should be taking the sum of the absolute log returns, not the absolute of the sum of returns.

$$ \sum|r| \neq \left|\sum r\right| $$

Do this and you'll notice that your new graph will have a 'floor' near 0 but above it - just like your professor's graph, whereas your current graph goes to 0, this is where price hasn't moved over your rolling period.

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.