Page 1 of 1

Prediction error and its variance

Posted: Sat Sep 12, 2026 12:03 am
by hardmann
Dear Tom:

I will estimate prediction error and its variance of GDP. I have decomposied the log GDP into trend and cycle components.How can I esitmate prediction error and its variance of GDP. Firstly,computing prediction error and its variance of the trend and cycle components, then summing them?
I refer to the example on page 8 of the SSM DSGE workbook.
as follows:

set trend * forecastl = xstates(t)(1)
set cycle * forecastl = xstates(t)(3)
set p_trend * forecastl = %scalar(vstates(t)(1,1))
set p_cycle * forecastl = %scalar(vstates(t)(3,3))

set trend_lower * forecastl = trend -sqrt(p_trend)*%invnormal(.95)
set trend_up * forecastl = trend +sqrt(p_trend)*%invnormal(.95)
set cycle_lower * forecastl = trend -sqrt(p_cycle)*%invnormal(.95)
set cycle_up * forecastl = trend +sqrt(p_cycle)*%invnormal(.95)

set lgdp_lower * forecastl= trend_lower + cycle_lower
set lgdp_up * forecastl = trend_up + cycle_up

Is right?

Could I use vhat and svhat option in DLM?

While I saw example on Chapter 8 of the Commandeur & Koopman, An Introduction to State Space Time Series Analysis.

dlm(a=a,c=c,sv=sigsqeps,f=f,sw=%diag(||sigsqxi,sigsqomega||),exact,$
y=%if(t<=1983:1,logksi-explan,%na),yhat=yhat,svhat=svhat) / xstates vstates
*
set forecast 1970:1 * = explan+%if(t<=1983:1,%scalar(yhat),%dot(c,xstates))
set fvariance 1970:1 * = %if(t<=1983:1,%scalar(svhat),%qform(vstates,c))
*
set upper = forecast+1.64*sqrt(fvariance)
set lower = forecast-1.64*sqrt(fvariance)

Best Regard
Hardmann