Stock-Watson Factor Model with Missing Data
Posted: Fri Jul 30, 2010 5:18 pm
We had a question about how to adapt the Stock-Watson dynamic factor model to situations where the observables have missing data. This is actually a very simple adjustment. For maximum likelihood estimation, there is no adjustment needed at all---DLM will properly handle the partial observables. For Gibbs sampling, the conditional simulation step (which generates the cycle and error terms given the data) produces, as a side effect, values for the missing y's. The following will put those into the VECT[SERIES] named YHAT (which is declared earlier).
Then YHAT rather than Y is used in the AR regressions later:
Program file:
Data file: (same as for swgibbs)
Code: Select all
dlm(type=csimulate,presample=ergodic,a=a,c=c,f=f,sw=sw,y=%xt(y,t)) rstart rend xstates
*
* Put the conditionally simulated values of y into yhat. These will
* match wherever y exists.
*
do i=1,n
set yhat(i) rstart rend = [vector] ypatch=tr(c)*xstates,ypatch(i)
end do iCode: Select all
do i=1,n
filter(weights=1.0~~-1.0*psi(i),type=lagging) yhat(i) / fy
filter(weights=1.0~~-1.0*psi(i),type=lagging) cycle / fcycle
cmom
# fcycle{0 to glags(i)} fy
compute gamma(i)=%ranmvpostcmom(%cmom,1.0/sigsqe(i),hgamma(i),bgamma(i))
end do i