Time varying structural VAR
[rvar]=Hetero_TVP_VAR1(nlag,Y,Z,nrep,nburn,prior,libsave,nrep_max)
* nlag = a scalar, the # of lags of the VAR
* Y = a (T x M) matrix of endogenous variables
* Z = a ((T-lnag)*M x nZ) matrix of exogenous variables
* nrep = # of replications taken into account
* nburn = # of replications not taken into account ("burned": the total # of draws is therefore nrep+ nburn)
* prior = a prior tlist
* libsave = name of the library where the resultys will be stored
* nrep_max = maximum number of iterations for a storing file
* arg1,...,argn = optional arguments that can be:
- 'exo=list(exo1,..., exon) if the user wants to add exogenous variables to the VAR, exoi then collects the exogenous variables of equation i
- 'nocte' if the user does not want constants in the VAR
- 'dropna' if the user wants to drop NA values from the data instead of generating an error
* rvar = a results tlist with:
- rvar('meth') = 'heteroskedastic tvp var'
- rvar('y') = matrix, the endogenous variables
- rvar('x') = matrix, the exogenous variables
- rvar('nobs') = # of observations used for estimation
- rvar('nendo') = # of endogenous variables
- rvar('nrep') = # of replications taken into account for the calculation of psoterior densities
- rvar('nburn') = # of replications not taken into account for the calculation of psoterior densities
- rvar('nlag') = # of lags in the VAR
- rvar('A_0_prmean') = mean of the prior for the A(0) coefficients
- rvar('A_0_prvar') = variance of the prior for the A(0) coefficients
- rvar('B_0_prmean') = mean of the prior for the B(0) coefficients
- rvar('B_0_prvar') = variance of the prior for the B(0) coefficients
- rvar('logsigma_prmean') = mean of the prior for the log of the Sigma(t) variances
- rvar('logsigma_prvar') = variance of the tvp prior for the log of the Sigma(t) variances
- rvar('Q_prmean') = mean of the prior for the Q variance matrix
- rvar('Q_prvar') = variance of the prior for the Q variance matrix
- rvar('W_prmean') = mean of the prior for the W variance matrix
- rvar('W_prvar') = variance of the prior for the W variance matrix
- rvar('S_prmean') = mean of the prior for the S variance matrix
- rvar('S_prvar') = variance of tvp prior for the S variance matrix
- rvar('Bt_postmean') = estimated matrix of the B(t) coefficients (averaged over the replications)
- rvar('At_postmean') = estimated matrix of the A(t) coefficients (averaged over the replications)
- rvar('Sigt_postmean') = estimated matrix of the Sigma(t) coefficients (averaged over the replications)
- rvar('Qmean') = estimated value of the Q variance matrix (averaged over the replications)
- rvar('Smean') = estimated value of the S variance matrix (averaged over the replications)
- rvar('Wmean') = estimated value of the W variance matrix (averaged over the replications)
- rvar('Sigmamean') = estimated value of the Sigma(t) variance matrices (averaged over the replications)
- rvar('.dat Bt') = a string vector, the names of the databases where all B(t) draws are stored
- rvar('.dat At') = a string vector, the names of the databases where all A(t) draws are stored
- rvar('.dat Sigmat') = a string vector, the names of the databases where all draws of Sigmat are stored
- rvar('.dat Htstd') = a string vector, the names of the databases where the estimated variance of the shocks are stored
- rvar('.dat Q') = a string vector, the names of the databases where all Q draws are stored
- rvar('.dat S') = a string vector, the names of the databases where all S draws are stored
- rvar('.dat W') = a string vector, the names of the databases where all W draws are stored
stacksize('max') load(GROCERDIR+'\data\primiceri.dat') mkdir(GROCERDIR+'\temp') nlag=2 bounds('1953q3','1963q2') prior=tvpvar_prior0(nlag,4,4,0.01,0.01,0.1,['Inflation';'Unemployment';'rate_3m']) bounds('1963q1','2001q3')// caution: bounds are lagged by 2 periods wr the estimation period because of the lags in the VAR y=explone(['Inflation';'Unemployment';'rate_3m']) z=ones(153,1) .*. eye(3,3) res=Hetero_TVP_VAR1(nlag,y,z,10000,2000,prior,path,2000) // This example reproduces the results of the paper by Primeceri (2005), slightly modified // by the corridendum by Del Negro and Primiceri (2014): the varaibles are United states inflation // inflation, unemployment and 3 months interest rates, collected in GROCERDIR+'\data\primiceri.dat') // database. The number of lags is set to 2, number of useful draws to 10000, number of discarded // drawss to 2000 and number of draws per database to 2000. Databases are stored into folder // GROCERDIR+'\temp'. Priors have been set in function tvpvar_prior0, with dilatation factors // applied to the ols estimates of A0 and B0 over the training sample '1953q3' to '1963q2' set to // 4, the the dilatation factors applied, squared, to (n+1) for the inverse Wishart prior of W, Q and // S set 0.01, 0.01 and 0.1 respectively | ![]() | ![]() |