I encounter a problem in calculate some variable in R.
It is about the volatility model (GARCH).
The formula I need to apply is this:
For the first sigma, I use some default value I calculated before. From the second, I need to quote the previous one and add another column's value.
I want to create a new column called sigma_forecast.
sigma_forecast 1 = sigma2
sigma_forecast 2 = 0.96 * sigma_forecast 1 + 0.04 * r2_lag_1
sigma_forecast 3 = 0.96 * sigma_forecast 2 + 0.04 * r2_lag_1


Created on 2021-10-27 by the reprex package (v2.0.1)