conditional forecasts and singular value decomposition

Questions and discussions on Vector Autoregressions
tclark
Posts: 99
Joined: Wed Nov 08, 2006 3:20 pm

conditional forecasts and singular value decomposition

Unread post by tclark »

For a project of mine that produces conditional forecasting with large VARs, out of numerical concerns some readers have asked to see results produced with the algorithm of the following paper: Jarocinski, Marek (2010), "Conditional forecasts and uncertainty about forecast revisions in vector autoregressions," Economics Letters 108, 257-259. Does anyone have code for his algorithm to share? I have the conditional forecast mean piece figured out, using the U, D, and V1 pieces computed with the %svdecomp function in RATS. The piece that seems trickier is the innovation variance piece (for simulation), which uses a matrix V2 that is computed in Jarocinski's version of the SVD but does not get computed (perhaps I am mistaken) in what seems to be the more compact form of the SVD used in the %svdecomp function. Any suggestions would be a great help.
Todd Clark
Economic Research Dept.
Federal Reserve Bank of Cleveland
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: conditional forecasts and singular value decomposition

Unread post by TomDoan »

Code: Select all

compute r=%ranmat(15,5)
compute rr=r*tr(r)
compute svd=%svdecomp(rr)
*
* This breaks down the V matrix into the parts associated with the non-zero (V1) and zero (V2) singular values
*
compute [vector] d=svd(2)
sstats 1 %size(d) (abs(d(t))>1.e-12)>>rank
compute irank=fix(rank)
compute [rect] v=svd(3)
compute v1=%xsubmat(v,1,%rows(v),1,irank)
compute v2=%xsubmat(v,1,%rows(v),irank+1,%cols(v))
Note that conditional forecasting is actually a special case of Kalman smoothing (conditional simulation for simulations) so it could be done without doing an inversion larger than the number of conditions at any given time period.
tclark
Posts: 99
Joined: Wed Nov 08, 2006 3:20 pm

Re: conditional forecasts and singular value decomposition

Unread post by tclark »

Thanks very much, Tom, for the reply and its speed. Sorry, though, that I am still a little confused and stuck as a result. In the Jarocinski approach, he takes the SVD of a matrix R tilde (corresponding to the transpose of the R matrix in your conditional forecast code) that isn't square, having dimension k by q, where q is the number of conditions and k is the total number of forecasts (# horizons by # variables). When I apply the SVD function to this not square matrix, I don't get the columns q+1 through k that are in his V matrix, in those columns (and become V2). The third matrix produced by %svdecomp has dimension k by q --- I only get the stuff corresponding to the q non-zero values. Is there an easy way to get the stuff corresponding to columns q+1 through k of his V matrix?
Todd Clark
Economic Research Dept.
Federal Reserve Bank of Cleveland
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: conditional forecasts and singular value decomposition

Unread post by TomDoan »

If you do the %SVDECOMP on the transpose of R-tilde, you get
svddecomp.gif
svddecomp.gif (3.91 KiB) Viewed 7962 times
with the last following because of idempotency. So that becomes the matrix you apply to the normals to get the covariance matrix. The mean part is straightforward.
tclark
Posts: 99
Joined: Wed Nov 08, 2006 3:20 pm

Re: conditional forecasts and singular value decomposition

Unread post by tclark »

Got it -- thanks much, Tom
Todd Clark
Economic Research Dept.
Federal Reserve Bank of Cleveland
Post Reply