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

• It could be possible that the lookback period is different. I see that the realized variance is usually lower in the Prof's graph compared to yours. If you compute RV over a longer period and more returns, what happens is that the var itself is less responsive to the recent fluctuations and more "stabilized". Commented Aug 1 at 1:49
• @KaiSqDist What exactly do you mean by lookback period? should I add a moving average in my log returns? Commented Aug 1 at 13:01

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.

• Please check OP I added the 2 graphs that you suggested. They are obviously different from the professor's. I also dont understand some of your sentences ,can you check them. Commented Aug 1 at 13:19
• Your professor is likely doing a rolling period average variance. So the 2nd "WTIRV" chart is closer to this. Are you just plotting single day squared moves? Try taking a 30 day sum or average to return a chart like your professors. Which sentences do you not understand? Commented Aug 1 at 14:45
• will try, I meant your last paragraph. Did you mean it will "not" have a floor? And the "price moved over" was slightly clarified by your comment now, you suggest making an MA for my daily RV? Or calculate the 30-day window RV? Yes its just daily RVs Commented Aug 1 at 17:50
• Doesnt work, I tried taking the MA of existing daily RV, taking the RV of 30day MA WTI prices and the squared difference of 10-dayMA log returns minus daily log returns and they all produce a broken up line without the floor at the "20" level. Commented Aug 1 at 19:46
• None of those are typical ways to calculate RV. Just take a 30 day average of the squared returns. Commented Aug 2 at 6:59