Stock-Watson Factor Model with Missing Data

Discussion of State Space and Dynamic Stochastic General Equilibrium Models
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Stock-Watson Factor Model with Missing Data

Unread post by TomDoan »

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).

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 i
Then YHAT rather than Y is used in the AR regressions later:

Code: 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
Program file:
swgibbsmissing.rpf
(7.22 KiB) Downloaded 1053 times
Data file: (same as for swgibbs)
fulldta.prn
(29.43 KiB) Downloaded 1184 times
Post Reply