# Calculate returns in percentages
logReturns <- 100 * makeReturns(SPYRM$CLOSE)[-1]
# Combine both returns and realized measures into one xts
# Due to return calculation, the first observation is missing
dataSPY <- xts::xts(cbind(logReturns, SPYRM$BPV5[-1] * 10000), order.by = SPYRM$DT[-1])
# Fit the HEAVY model
fittedHEAVY <- HEAVYmodel(dataSPY)
# Examine the estimated coefficients and robust standard errors
fittedHEAVY
# Calculate iterative multi-step-ahead forecasts
predict(fittedHEAVY, stepsAhead = 12)
Run the code above in your browser using DataLab