Detailed description
Algorithm
The calculations are done using Kalman smoothing (for log-linear, with iterated linearizations). All of the above references use other constructive calculations, but they, in fact, are simply derived special cases of Kalman smoothing. This is the chapter from the State Space/DSGE course which provides detailed information on how this is done.
Example
Code: Select all
*
* Example of the use of @disaggregate
*
* Data are from FRED. INDPRO is (monthly) industrial production, though
* we will use quarterly averages. GDPCA are annual GDP numbers (which
* start in 1929:1), GDPC1 are quarterly (starting in 1947:1). We'll use
* @DISAGGREGATE to create an estimate of quarterly GDP from 1929 on
* using industrial production as a related series.
*
open data demodisaggregate.rat
calendar(q) 1929:1
data(format=rats,compact=average) 1929:01 2012:04 indpro gdpc1 gdpca
*
* The model is log-linear using log IP as the explanatory variable, with
* an RWAR1 time series model, that is the assumed model at the quarterly
* level is
*
* log y(t) = beta x log ip(t) + z(t)
*
* where z(t) is an ARIMA(1,1,0) process
*
* with the constraint that the average of y across each year matches the
* observed value of GDPCA.
*
set logip = log(indpro)
@disaggregate(tsmodel=rwar1,model=loglin,factor=4,maintain=average,print) gdpca / gdpcq
# logip
*
* Over the full sample, the two lines run almost on top of each other,
* so this graphs the estimated quarterly value and the official
* quarterly value for a 10 year range.
*
graph(overlay=line,key=upleft,klabels=||"Official","Estimated","IP"||) 3
# gdpc1 2003:1 2012:4
# gdpcq 2003:1 2012:4
# indpro 2003:1 2012:4