Main Content

summarize

Distribution summary statistics of Bayesian vector autoregression (VAR) model

Since R2020a

Description

example

summarize(Mdl) displays, at the command line, a tabular summary of the coefficients of the Bayesian VAR(p) model Mdl, and the innovations covariance matrix. The summary includes the means and standard deviations of the distribution Mdl represents.

example

summarize(Mdl,display) prints the summary using the display style display.

example

Summary = summarize(Mdl) returns distribution summary statistics Summary.

Examples

collapse all

Consider the 3-D VAR(4) model for the US inflation (INFL), unemployment (UNRATE), and federal funds (FEDFUNDS) rates.

[INFLtUNRATEtFEDFUNDSt]=c+j=14Φj[INFLt-jUNRATEt-jFEDFUNDSt-j]+[ε1,tε2,tε3,t].

For all t, εt is a series of independent 3-D normal innovations with a mean of 0 and covariance Σ. Assume that a prior distribution π([Φ1,...,Φ4,c],Σ) governs the behavior of the parameters. Consider using Minnesota regularization to obtain a parsimonious representation of the coefficient posterior distribution.

For each supported prior assumption, create the corresponding Bayesian VAR(4) model object for the three response variables by using bayesvarm. For each model that supports the option, specify all the following.

  • The response variable names.

  • Prior self-lag coefficients have variance 100. This large-variance setting allows the data to influence the posterior more than the prior.

  • Prior cross-lag coefficients have variance 1. This small-variance setting tightens the cross-lag coefficients to zero during estimation.

  • Prior coefficient covariances decay with increasing lag at a rate of 2 (that is, lower lags are more important than larger lags).

  • For the normal conjugate prior model, assume that the innovations covariance is the 3-D identity matrix.

seriesnames = ["INFL" "UNRATE" "FEDFUNDS"];
numseries = numel(seriesnames);
numlags = 4;

DiffusePriorMdl = bayesvarm(numseries,numlags,'SeriesNames',seriesnames);
ConjugatePriorMdl = bayesvarm(numseries,numlags,'ModelType','conjugate',...
    'SeriesNames',seriesnames,'Center',0.75,'SelfLag',100,'Decay',2);
SemiConjugatePriorMdl = bayesvarm(numseries,numlags,'ModelType','semiconjugate',...
    'SeriesNames',seriesnames,'Center',0.75,'SelfLag',100,'CrossLag',1,'Decay',2);
NormalPriorMdl = bayesvarm(numseries,numlags,'ModelType','normal',...
    'SeriesNames',seriesnames,'Center',0.75,'SelfLag',100,'CrossLag',1,'Decay',2,...
    'Sigma',eye(numseries));

For each model, display summary of the prior distribution.

summarize(DiffusePriorMdl)
             | Mean  Std 
-------------------------
 Constant(1) |   0   Inf 
 Constant(2) |   0   Inf 
 Constant(3) |   0   Inf 
 AR{1}(1,1)  |   0   Inf 
 AR{1}(2,1)  |   0   Inf 
 AR{1}(3,1)  |   0   Inf 
 AR{1}(1,2)  |   0   Inf 
 AR{1}(2,2)  |   0   Inf 
 AR{1}(3,2)  |   0   Inf 
 AR{1}(1,3)  |   0   Inf 
 AR{1}(2,3)  |   0   Inf 
 AR{1}(3,3)  |   0   Inf 
 AR{2}(1,1)  |   0   Inf 
 AR{2}(2,1)  |   0   Inf 
 AR{2}(3,1)  |   0   Inf 
 AR{2}(1,2)  |   0   Inf 
 AR{2}(2,2)  |   0   Inf 
 AR{2}(3,2)  |   0   Inf 
 AR{2}(1,3)  |   0   Inf 
 AR{2}(2,3)  |   0   Inf 
 AR{2}(3,3)  |   0   Inf 
 AR{3}(1,1)  |   0   Inf 
 AR{3}(2,1)  |   0   Inf 
 AR{3}(3,1)  |   0   Inf 
 AR{3}(1,2)  |   0   Inf 
 AR{3}(2,2)  |   0   Inf 
 AR{3}(3,2)  |   0   Inf 
 AR{3}(1,3)  |   0   Inf 
 AR{3}(2,3)  |   0   Inf 
 AR{3}(3,3)  |   0   Inf 
 AR{4}(1,1)  |   0   Inf 
 AR{4}(2,1)  |   0   Inf 
 AR{4}(3,1)  |   0   Inf 
 AR{4}(1,2)  |   0   Inf 
 AR{4}(2,2)  |   0   Inf 
 AR{4}(3,2)  |   0   Inf 
 AR{4}(1,3)  |   0   Inf 
 AR{4}(2,3)  |   0   Inf 
 AR{4}(3,3)  |   0   Inf 
    Innovations Covariance Matrix   
          |  INFL  UNRATE  FEDFUNDS 
------------------------------------
 INFL     | NaN     NaN      NaN    
          | (NaN)   (NaN)    (NaN)  
 UNRATE   | NaN     NaN      NaN    
          | (NaN)   (NaN)    (NaN)  
 FEDFUNDS | NaN     NaN      NaN    
          | (NaN)   (NaN)    (NaN)  

Diffuse prior models put equal weight on all model coefficients. This specification allows the data to determine the posterior distribution.

summarize(ConjugatePriorMdl)
             |  Mean     Std   
-------------------------------
 Constant(1) |  0      33.3333 
 Constant(2) |  0      33.3333 
 Constant(3) |  0      33.3333 
 AR{1}(1,1)  | 0.7500   3.3333 
 AR{1}(2,1)  |  0       3.3333 
 AR{1}(3,1)  |  0       3.3333 
 AR{1}(1,2)  |  0       3.3333 
 AR{1}(2,2)  | 0.7500   3.3333 
 AR{1}(3,2)  |  0       3.3333 
 AR{1}(1,3)  |  0       3.3333 
 AR{1}(2,3)  |  0       3.3333 
 AR{1}(3,3)  | 0.7500   3.3333 
 AR{2}(1,1)  |  0       1.6667 
 AR{2}(2,1)  |  0       1.6667 
 AR{2}(3,1)  |  0       1.6667 
 AR{2}(1,2)  |  0       1.6667 
 AR{2}(2,2)  |  0       1.6667 
 AR{2}(3,2)  |  0       1.6667 
 AR{2}(1,3)  |  0       1.6667 
 AR{2}(2,3)  |  0       1.6667 
 AR{2}(3,3)  |  0       1.6667 
 AR{3}(1,1)  |  0       1.1111 
 AR{3}(2,1)  |  0       1.1111 
 AR{3}(3,1)  |  0       1.1111 
 AR{3}(1,2)  |  0       1.1111 
 AR{3}(2,2)  |  0       1.1111 
 AR{3}(3,2)  |  0       1.1111 
 AR{3}(1,3)  |  0       1.1111 
 AR{3}(2,3)  |  0       1.1111 
 AR{3}(3,3)  |  0       1.1111 
 AR{4}(1,1)  |  0       0.8333 
 AR{4}(2,1)  |  0       0.8333 
 AR{4}(3,1)  |  0       0.8333 
 AR{4}(1,2)  |  0       0.8333 
 AR{4}(2,2)  |  0       0.8333 
 AR{4}(3,2)  |  0       0.8333 
 AR{4}(1,3)  |  0       0.8333 
 AR{4}(2,3)  |  0       0.8333 
 AR{4}(3,3)  |  0       0.8333 
      Innovations Covariance Matrix      
          |   INFL     UNRATE   FEDFUNDS 
-----------------------------------------
 INFL     |  0.1111     0         0      
          | (0.0594)  (0.0398)  (0.0398) 
 UNRATE   |   0        0.1111     0      
          | (0.0398)  (0.0594)  (0.0398) 
 FEDFUNDS |   0         0        0.1111  
          | (0.0398)  (0.0398)  (0.0594) 

With a tighter prior variance around 0 for larger lags, the posterior of the conjugate model is likely to be more sparse that the posterior of the diffuse model.

summarize(SemiConjugatePriorMdl)
             |  Mean     Std  
------------------------------
 Constant(1) |  0       100   
 Constant(2) |  0       100   
 Constant(3) |  0       100   
 AR{1}(1,1)  | 0.7500   10    
 AR{1}(2,1)  |  0       1     
 AR{1}(3,1)  |  0       1     
 AR{1}(1,2)  |  0       1     
 AR{1}(2,2)  | 0.7500   10    
 AR{1}(3,2)  |  0       1     
 AR{1}(1,3)  |  0       1     
 AR{1}(2,3)  |  0       1     
 AR{1}(3,3)  | 0.7500   10    
 AR{2}(1,1)  |  0       5     
 AR{2}(2,1)  |  0      0.5000 
 AR{2}(3,1)  |  0      0.5000 
 AR{2}(1,2)  |  0      0.5000 
 AR{2}(2,2)  |  0       5     
 AR{2}(3,2)  |  0      0.5000 
 AR{2}(1,3)  |  0      0.5000 
 AR{2}(2,3)  |  0      0.5000 
 AR{2}(3,3)  |  0       5     
 AR{3}(1,1)  |  0      3.3333 
 AR{3}(2,1)  |  0      0.3333 
 AR{3}(3,1)  |  0      0.3333 
 AR{3}(1,2)  |  0      0.3333 
 AR{3}(2,2)  |  0      3.3333 
 AR{3}(3,2)  |  0      0.3333 
 AR{3}(1,3)  |  0      0.3333 
 AR{3}(2,3)  |  0      0.3333 
 AR{3}(3,3)  |  0      3.3333 
 AR{4}(1,1)  |  0      2.5000 
 AR{4}(2,1)  |  0      0.2500 
 AR{4}(3,1)  |  0      0.2500 
 AR{4}(1,2)  |  0      0.2500 
 AR{4}(2,2)  |  0      2.5000 
 AR{4}(3,2)  |  0      0.2500 
 AR{4}(1,3)  |  0      0.2500 
 AR{4}(2,3)  |  0      0.2500 
 AR{4}(3,3)  |  0      2.5000 
      Innovations Covariance Matrix      
          |   INFL     UNRATE   FEDFUNDS 
-----------------------------------------
 INFL     |  0.1111     0         0      
          | (0.0594)  (0.0398)  (0.0398) 
 UNRATE   |   0        0.1111     0      
          | (0.0398)  (0.0594)  (0.0398) 
 FEDFUNDS |   0         0        0.1111  
          | (0.0398)  (0.0398)  (0.0594) 
summarize(NormalPriorMdl)
             |  Mean     Std  
------------------------------
 Constant(1) |  0       100   
 Constant(2) |  0       100   
 Constant(3) |  0       100   
 AR{1}(1,1)  | 0.7500   10    
 AR{1}(2,1)  |  0       1     
 AR{1}(3,1)  |  0       1     
 AR{1}(1,2)  |  0       1     
 AR{1}(2,2)  | 0.7500   10    
 AR{1}(3,2)  |  0       1     
 AR{1}(1,3)  |  0       1     
 AR{1}(2,3)  |  0       1     
 AR{1}(3,3)  | 0.7500   10    
 AR{2}(1,1)  |  0       5     
 AR{2}(2,1)  |  0      0.5000 
 AR{2}(3,1)  |  0      0.5000 
 AR{2}(1,2)  |  0      0.5000 
 AR{2}(2,2)  |  0       5     
 AR{2}(3,2)  |  0      0.5000 
 AR{2}(1,3)  |  0      0.5000 
 AR{2}(2,3)  |  0      0.5000 
 AR{2}(3,3)  |  0       5     
 AR{3}(1,1)  |  0      3.3333 
 AR{3}(2,1)  |  0      0.3333 
 AR{3}(3,1)  |  0      0.3333 
 AR{3}(1,2)  |  0      0.3333 
 AR{3}(2,2)  |  0      3.3333 
 AR{3}(3,2)  |  0      0.3333 
 AR{3}(1,3)  |  0      0.3333 
 AR{3}(2,3)  |  0      0.3333 
 AR{3}(3,3)  |  0      3.3333 
 AR{4}(1,1)  |  0      2.5000 
 AR{4}(2,1)  |  0      0.2500 
 AR{4}(3,1)  |  0      0.2500 
 AR{4}(1,2)  |  0      0.2500 
 AR{4}(2,2)  |  0      2.5000 
 AR{4}(3,2)  |  0      0.2500 
 AR{4}(1,3)  |  0      0.2500 
 AR{4}(2,3)  |  0      0.2500 
 AR{4}(3,3)  |  0      2.5000 
   Innovations Covariance Matrix   
          | INFL  UNRATE  FEDFUNDS 
-----------------------------------
 INFL     |  1      0        0     
          |  (0)    (0)      (0)   
 UNRATE   |  0      1        0     
          |  (0)    (0)      (0)   
 FEDFUNDS |  0      0        1     
          |  (0)    (0)      (0)   

Semiconjugate and normal conjugate prior models yield a richer prior specification than the conjugate and diffuse models.

Consider the 3-D VAR(4) model of Inspect Minnesota Prior Assumptions Among Models. Assume that the prior distribution is diffuse.

Load the US macroeconomic data set. Compute the inflation rate, stabilize the unemployment and federal funds rates, and remove missing values.

load Data_USEconModel
seriesnames = ["INFL" "UNRATE" "FEDFUNDS"];
DataTimeTable.INFL = 100*[NaN; price2ret(DataTimeTable.CPIAUCSL)];

DataTimeTable.DUNRATE = [NaN; diff(DataTimeTable.UNRATE)];
DataTimeTable.DFEDFUNDS = [NaN; diff(DataTimeTable.FEDFUNDS)];
seriesnames(2:3) = "D" + seriesnames(2:3);
rmDataTimeTable = rmmissing(DataTimeTable);

Create a diffuse Bayesian VAR(4) prior model for the three response series. Specify the response variable names.

numseries = numel(seriesnames);
numlags = 4;

PriorMdl = bayesvarm(numseries,numlags,'SeriesNames',seriesnames);

Estimate the posterior distribution.

PosteriorMdl = estimate(PriorMdl,rmDataTimeTable{:,seriesnames});
Bayesian VAR under diffuse priors
Effective Sample Size:          197
Number of equations:            3
Number of estimated Parameters: 39
             |   Mean     Std  
-------------------------------
 Constant(1) |  0.1007  0.0832 
 Constant(2) | -0.0499  0.0450 
 Constant(3) | -0.4221  0.1781 
 AR{1}(1,1)  |  0.1241  0.0762 
 AR{1}(2,1)  | -0.0219  0.0413 
 AR{1}(3,1)  | -0.1586  0.1632 
 AR{1}(1,2)  | -0.4809  0.1536 
 AR{1}(2,2)  |  0.4716  0.0831 
 AR{1}(3,2)  | -1.4368  0.3287 
 AR{1}(1,3)  |  0.1005  0.0390 
 AR{1}(2,3)  |  0.0391  0.0211 
 AR{1}(3,3)  | -0.2905  0.0835 
 AR{2}(1,1)  |  0.3236  0.0868 
 AR{2}(2,1)  |  0.0913  0.0469 
 AR{2}(3,1)  |  0.3403  0.1857 
 AR{2}(1,2)  | -0.0503  0.1647 
 AR{2}(2,2)  |  0.2414  0.0891 
 AR{2}(3,2)  | -0.2968  0.3526 
 AR{2}(1,3)  |  0.0450  0.0413 
 AR{2}(2,3)  |  0.0536  0.0223 
 AR{2}(3,3)  | -0.3117  0.0883 
 AR{3}(1,1)  |  0.4272  0.0860 
 AR{3}(2,1)  | -0.0389  0.0465 
 AR{3}(3,1)  |  0.2848  0.1841 
 AR{3}(1,2)  |  0.2738  0.1620 
 AR{3}(2,2)  |  0.0552  0.0876 
 AR{3}(3,2)  | -0.7401  0.3466 
 AR{3}(1,3)  |  0.0523  0.0428 
 AR{3}(2,3)  |  0.0008  0.0232 
 AR{3}(3,3)  |  0.0028  0.0917 
 AR{4}(1,1)  |  0.0167  0.0901 
 AR{4}(2,1)  |  0.0285  0.0488 
 AR{4}(3,1)  | -0.0690  0.1928 
 AR{4}(1,2)  | -0.1830  0.1520 
 AR{4}(2,2)  | -0.1795  0.0822 
 AR{4}(3,2)  |  0.1494  0.3253 
 AR{4}(1,3)  |  0.0067  0.0395 
 AR{4}(2,3)  |  0.0088  0.0214 
 AR{4}(3,3)  | -0.1372  0.0845 
       Innovations Covariance Matrix       
           |   INFL     DUNRATE  DFEDFUNDS 
-------------------------------------------
 INFL      |  0.3028   -0.0217     0.1579  
           | (0.0321)  (0.0124)   (0.0499) 
 DUNRATE   | -0.0217    0.0887    -0.1435  
           | (0.0124)  (0.0094)   (0.0283) 
 DFEDFUNDS |  0.1579   -0.1435     1.3872  
           | (0.0499)  (0.0283)   (0.1470) 

Summarize the posterior distribution; compare each estimation display type.

summarize(PosteriorMdl); % The default is 'table'.
             |   Mean     Std  
-------------------------------
 Constant(1) |  0.1007  0.0832 
 Constant(2) | -0.0499  0.0450 
 Constant(3) | -0.4221  0.1781 
 AR{1}(1,1)  |  0.1241  0.0762 
 AR{1}(2,1)  | -0.0219  0.0413 
 AR{1}(3,1)  | -0.1586  0.1632 
 AR{1}(1,2)  | -0.4809  0.1536 
 AR{1}(2,2)  |  0.4716  0.0831 
 AR{1}(3,2)  | -1.4368  0.3287 
 AR{1}(1,3)  |  0.1005  0.0390 
 AR{1}(2,3)  |  0.0391  0.0211 
 AR{1}(3,3)  | -0.2905  0.0835 
 AR{2}(1,1)  |  0.3236  0.0868 
 AR{2}(2,1)  |  0.0913  0.0469 
 AR{2}(3,1)  |  0.3403  0.1857 
 AR{2}(1,2)  | -0.0503  0.1647 
 AR{2}(2,2)  |  0.2414  0.0891 
 AR{2}(3,2)  | -0.2968  0.3526 
 AR{2}(1,3)  |  0.0450  0.0413 
 AR{2}(2,3)  |  0.0536  0.0223 
 AR{2}(3,3)  | -0.3117  0.0883 
 AR{3}(1,1)  |  0.4272  0.0860 
 AR{3}(2,1)  | -0.0389  0.0465 
 AR{3}(3,1)  |  0.2848  0.1841 
 AR{3}(1,2)  |  0.2738  0.1620 
 AR{3}(2,2)  |  0.0552  0.0876 
 AR{3}(3,2)  | -0.7401  0.3466 
 AR{3}(1,3)  |  0.0523  0.0428 
 AR{3}(2,3)  |  0.0008  0.0232 
 AR{3}(3,3)  |  0.0028  0.0917 
 AR{4}(1,1)  |  0.0167  0.0901 
 AR{4}(2,1)  |  0.0285  0.0488 
 AR{4}(3,1)  | -0.0690  0.1928 
 AR{4}(1,2)  | -0.1830  0.1520 
 AR{4}(2,2)  | -0.1795  0.0822 
 AR{4}(3,2)  |  0.1494  0.3253 
 AR{4}(1,3)  |  0.0067  0.0395 
 AR{4}(2,3)  |  0.0088  0.0214 
 AR{4}(3,3)  | -0.1372  0.0845 
       Innovations Covariance Matrix       
           |   INFL     DUNRATE  DFEDFUNDS 
-------------------------------------------
 INFL      |  0.3028   -0.0217     0.1579  
           | (0.0321)  (0.0124)   (0.0499) 
 DUNRATE   | -0.0217    0.0887    -0.1435  
           | (0.0124)  (0.0094)   (0.0283) 
 DFEDFUNDS |  0.1579   -0.1435     1.3872  
           | (0.0499)  (0.0283)   (0.1470) 

The default is the same default tabular display that estimate prints.

summarize(PosteriorMdl,'equation');
                                                                                 VAR Equations                                                                                
           | INFL(-1)  DUNRATE(-1)  DFEDFUNDS(-1)  INFL(-2)  DUNRATE(-2)  DFEDFUNDS(-2)  INFL(-3)  DUNRATE(-3)  DFEDFUNDS(-3)  INFL(-4)  DUNRATE(-4)  DFEDFUNDS(-4)  Constant 
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 INFL      |  0.1241     -0.4809        0.1005      0.3236     -0.0503        0.0450      0.4272      0.2738        0.0523      0.0167     -0.1830        0.0067      0.1007  
           | (0.0762)    (0.1536)      (0.0390)    (0.0868)    (0.1647)      (0.0413)    (0.0860)    (0.1620)      (0.0428)    (0.0901)    (0.1520)      (0.0395)    (0.0832) 
 DUNRATE   | -0.0219      0.4716        0.0391      0.0913      0.2414        0.0536     -0.0389      0.0552        0.0008      0.0285     -0.1795        0.0088     -0.0499  
           | (0.0413)    (0.0831)      (0.0211)    (0.0469)    (0.0891)      (0.0223)    (0.0465)    (0.0876)      (0.0232)    (0.0488)    (0.0822)      (0.0214)    (0.0450) 
 DFEDFUNDS | -0.1586     -1.4368       -0.2905      0.3403     -0.2968       -0.3117      0.2848     -0.7401        0.0028     -0.0690      0.1494       -0.1372     -0.4221  
           | (0.1632)    (0.3287)      (0.0835)    (0.1857)    (0.3526)      (0.0883)    (0.1841)    (0.3466)      (0.0917)    (0.1928)    (0.3253)      (0.0845)    (0.1781) 
 
       Innovations Covariance Matrix       
           |   INFL     DUNRATE  DFEDFUNDS 
-------------------------------------------
 INFL      |  0.3028   -0.0217     0.1579  
           | (0.0321)  (0.0124)   (0.0499) 
 DUNRATE   | -0.0217    0.0887    -0.1435  
           | (0.0124)  (0.0094)   (0.0283) 
 DFEDFUNDS |  0.1579   -0.1435     1.3872  
           | (0.0499)  (0.0283)   (0.1470) 

In the 'equation' display, rows correspond to response equations in the VAR system, and columns correspond to lagged response variables within equations. Elements in the table correspond to the posterior means of the corresponding coefficient; under each mean in parentheses is the standard deviation of the posterior.

summarize(PosteriorMdl,'matrix');
          VAR Coefficient Matrix of Lag 1         
           | INFL(-1)  DUNRATE(-1)  DFEDFUNDS(-1) 
--------------------------------------------------
 INFL      |  0.1241     -0.4809        0.1005    
           | (0.0762)    (0.1536)      (0.0390)   
 DUNRATE   | -0.0219      0.4716        0.0391    
           | (0.0413)    (0.0831)      (0.0211)   
 DFEDFUNDS | -0.1586     -1.4368       -0.2905    
           | (0.1632)    (0.3287)      (0.0835)   
 
          VAR Coefficient Matrix of Lag 2         
           | INFL(-2)  DUNRATE(-2)  DFEDFUNDS(-2) 
--------------------------------------------------
 INFL      |  0.3236     -0.0503        0.0450    
           | (0.0868)    (0.1647)      (0.0413)   
 DUNRATE   |  0.0913      0.2414        0.0536    
           | (0.0469)    (0.0891)      (0.0223)   
 DFEDFUNDS |  0.3403     -0.2968       -0.3117    
           | (0.1857)    (0.3526)      (0.0883)   
 
          VAR Coefficient Matrix of Lag 3         
           | INFL(-3)  DUNRATE(-3)  DFEDFUNDS(-3) 
--------------------------------------------------
 INFL      |  0.4272      0.2738        0.0523    
           | (0.0860)    (0.1620)      (0.0428)   
 DUNRATE   | -0.0389      0.0552        0.0008    
           | (0.0465)    (0.0876)      (0.0232)   
 DFEDFUNDS |  0.2848     -0.7401        0.0028    
           | (0.1841)    (0.3466)      (0.0917)   
 
          VAR Coefficient Matrix of Lag 4         
           | INFL(-4)  DUNRATE(-4)  DFEDFUNDS(-4) 
--------------------------------------------------
 INFL      |  0.0167     -0.1830        0.0067    
           | (0.0901)    (0.1520)      (0.0395)   
 DUNRATE   |  0.0285     -0.1795        0.0088    
           | (0.0488)    (0.0822)      (0.0214)   
 DFEDFUNDS | -0.0690      0.1494       -0.1372    
           | (0.1928)    (0.3253)      (0.0845)   
 
     Constant Term    
 INFL      |  0.1007  
           | (0.0832) 
 DUNRATE   | -0.0499  
           |  0.0450  
 DFEDFUNDS | -0.4221  
           |  0.1781  
 
       Innovations Covariance Matrix       
           |   INFL     DUNRATE  DFEDFUNDS 
-------------------------------------------
 INFL      |  0.3028   -0.0217     0.1579  
           | (0.0321)  (0.0124)   (0.0499) 
 DUNRATE   | -0.0217    0.0887    -0.1435  
           | (0.0124)  (0.0094)   (0.0283) 
 DFEDFUNDS |  0.1579   -0.1435     1.3872  
           | (0.0499)  (0.0283)   (0.1470) 

In the 'matrix' display, each table contains the posterior mean of the corresponding coefficient matrix. Under each mean in parentheses the posterior standard deviation.

Consider the 3-D VAR(4) model of Inspect Minnesota Prior Assumptions Among Models. Assume that the parameters follow a semiconjugate prior model.

Load the US macroeconomic data set. Compute the inflation rate, stabilize the unemployment aand federal funds rates, and remove missing values.

load Data_USEconModel
seriesnames = ["INFL" "UNRATE" "FEDFUNDS"];
DataTimeTable.INFL = 100*[NaN; price2ret(DataTimeTable.CPIAUCSL)];

DataTimeTable.DUNRATE = [NaN; diff(DataTimeTable.UNRATE)];
DataTimeTable.DFEDFUNDS = [NaN; diff(DataTimeTable.FEDFUNDS)];
seriesnames(2:3) = "D" + seriesnames(2:3);
rmDataTimeTable = rmmissing(DataTimeTable);

Create a semiconjugate Bayesian VAR(4) prior model for the three response series. Specify the response variable names, and suppress the estimation display.

numseries = numel(seriesnames);
numlags = 4;

PriorMdl = bayesvarm(numseries,numlags,'Model','semiconjugate',...
    'SeriesNames',seriesnames);

Estimate the posterior distribution. Suppress the estimation display.

PosteriorMdl = estimate(PriorMdl,rmDataTimeTable{:,seriesnames},'Display','off');

Because the posterior of a semiconjugate model is analytically intractable, PosteriorMdl is an empiricalbvarm model object storing the draws from the Gibbs sampler.

Summarize the posterior distribution; return the estimation summary.

Summary = summarize(PosteriorMdl);
             |   Mean     Std  
-------------------------------
 Constant(1) |  0.1830  0.0718 
 Constant(2) | -0.0808  0.0413 
 Constant(3) | -0.0161  0.1309 
 AR{1}(1,1)  |  0.2246  0.0650 
 AR{1}(2,1)  | -0.0263  0.0340 
 AR{1}(3,1)  | -0.0263  0.0775 
 AR{1}(1,2)  | -0.0837  0.0824 
 AR{1}(2,2)  |  0.3665  0.0740 
 AR{1}(3,2)  | -0.1283  0.0948 
 AR{1}(1,3)  |  0.1362  0.0323 
 AR{1}(2,3)  |  0.0154  0.0198 
 AR{1}(3,3)  | -0.0538  0.0685 
 AR{2}(1,1)  |  0.2518  0.0700 
 AR{2}(2,1)  |  0.0928  0.0352 
 AR{2}(3,1)  |  0.0373  0.0628 
 AR{2}(1,2)  | -0.0097  0.0632 
 AR{2}(2,2)  |  0.1657  0.0709 
 AR{2}(3,2)  | -0.0254  0.0688 
 AR{2}(1,3)  |  0.0329  0.0308 
 AR{2}(2,3)  |  0.0341  0.0199 
 AR{2}(3,3)  | -0.1451  0.0637 
 AR{3}(1,1)  |  0.2895  0.0665 
 AR{3}(2,1)  |  0.0013  0.0332 
 AR{3}(3,1)  | -0.0036  0.0530 
 AR{3}(1,2)  |  0.0322  0.0538 
 AR{3}(2,2)  | -0.0150  0.0667 
 AR{3}(3,2)  | -0.0369  0.0568 
 AR{3}(1,3)  |  0.0368  0.0298 
 AR{3}(2,3)  | -0.0083  0.0194 
 AR{3}(3,3)  |  0.1516  0.0603 
 AR{4}(1,1)  |  0.0452  0.0644 
 AR{4}(2,1)  |  0.0225  0.0325 
 AR{4}(3,1)  | -0.0097  0.0470 
 AR{4}(1,2)  | -0.0218  0.0468 
 AR{4}(2,2)  | -0.1125  0.0611 
 AR{4}(3,2)  |  0.0013  0.0491 
 AR{4}(1,3)  |  0.0180  0.0273 
 AR{4}(2,3)  |  0.0084  0.0179 
 AR{4}(3,3)  | -0.0815  0.0594 
       Innovations Covariance Matrix       
           |   INFL     DUNRATE  DFEDFUNDS 
-------------------------------------------
 INFL      |  0.2983   -0.0219     0.1750  
           | (0.0307)  (0.0121)   (0.0500) 
 DUNRATE   | -0.0219    0.0890    -0.1495  
           | (0.0121)  (0.0093)   (0.0290) 
 DFEDFUNDS |  0.1750   -0.1495     1.4730  
           | (0.0500)  (0.0290)   (0.1514) 
Summary
Summary = struct with fields:
               Description: "3-Dimensional VAR(4) Model"
    NumEstimatedParameters: 39
                     Table: [39x2 table]
                  CoeffMap: [39x1 string]
                 CoeffMean: [39x1 double]
                  CoeffStd: [39x1 double]
                 SigmaMean: [3x3 double]
                  SigmaStd: [3x3 double]

Summary is a structure array of fields containing posterior estimation information. For example, the CoeffMap field contains a list of the coefficient names. The order of the names corresponds to the order the all coefficient vector inputs and outputs. Display CoeffMap.

Summary.CoeffMap
ans = 39x1 string
    "AR{1}(1,1)"
    "AR{1}(1,2)"
    "AR{1}(1,3)"
    "AR{2}(1,1)"
    "AR{2}(1,2)"
    "AR{2}(1,3)"
    "AR{3}(1,1)"
    "AR{3}(1,2)"
    "AR{3}(1,3)"
    "AR{4}(1,1)"
    "AR{4}(1,2)"
    "AR{4}(1,3)"
    "Constant(1)"
    "AR{1}(2,1)"
    "AR{1}(2,2)"
    "AR{1}(2,3)"
    "AR{2}(2,1)"
    "AR{2}(2,2)"
    "AR{2}(2,3)"
    "AR{3}(2,1)"
    "AR{3}(2,2)"
    "AR{3}(2,3)"
    "AR{4}(2,1)"
    "AR{4}(2,2)"
    "AR{4}(2,3)"
    "Constant(2)"
    "AR{1}(3,1)"
    "AR{1}(3,2)"
    "AR{1}(3,3)"
    "AR{2}(3,1)"
      ⋮

Input Arguments

collapse all

Prior or posterior Bayesian VAR model, specified as a model object in this table.

Model ObjectDescription
conjugatebvarmDependent, matrix-normal-inverse-Wishart conjugate model returned by bayesvarm, conjugatebvarm, or estimate
semiconjugatebvarmIndependent, normal-inverse-Wishart semiconjugate prior model returned by bayesvarm or semiconjugatebvarm
diffusebvarmDiffuse prior model returned by bayesvarm or diffusebvarm
empiricalbvarmPrior or posterior model characterized by random draws from respective distributions, returned by empiricalbvarm or estimate

Distribution summary display style, specified as a value in this table.

ValueDescription
'off'summarize does not print to the command line.
'table'

summarize prints the following:

  • Estimation information

  • Tabular summary of coefficient posterior means and standard deviations; each row corresponds to a coefficient, and each column corresponds to an estimate type

  • Posterior mean of the innovations covariance matrix with standard deviations in parentheses

'equation'

summarize prints the following:

  • Estimation information

  • Tabular summary of posterior means and standard deviations; each row corresponds to a response variable in the system, and each column corresponds to a coefficient in the equation (for example, the column labeled Y1(-1) contains the estimates of the lag 1 coefficient of the first response variable in each equation)

  • Posterior mean of the innovations covariance matrix with standard deviations in parentheses.

'matrix'

summarize prints the following:

  • Estimation information

  • Separate tabular displays of posterior means and standard deviations (in parentheses) for each parameter in the model Φ1,…, Φp, c, δ, Β, and Σ

Data Types: char | string

Output Arguments

collapse all

Distribution summary statistics, returned as a structure array containing these fields:

FieldDescriptionData type
DescriptionModel descriptionstring scalar
NumEstimatedParametersNumber of coefficientsnumeric scalar
TableTable of coefficient distribution means and standard deviations; each row corresponds to a coefficient and each column corresponds to a statistictable
CoeffMapCoefficient namesstring vector
CoeffMeanCoefficient distribution means numeric vector, rows correspond to CoeffMap
CoeffStdCoefficient distribution standard deviationsnumeric vector, rows correspond to CoeffMap
SigmaMeanInnovations covariance distribution mean matrixnumeric matrix, rows and columns correspond to response equations
SigmaStdInnovations covariance distribution standard deviation matrixnumeric matrix, rows and columns correspond to response equations

More About

collapse all

Bayesian Vector Autoregression (VAR) Model

A Bayesian VAR model treats all coefficients and the innovations covariance matrix as random variables in the m-dimensional, stationary VARX(p) model. The model has one of the three forms described in this table.

ModelEquation
Reduced-form VAR(p) in difference-equation notation

yt=Φ1yt1+...+Φpytp+c+δt+Βxt+εt.

Multivariate regression

yt=Ztλ+εt.

Matrix regression

yt=Λzt+εt.

For each time t = 1,...,T:

  • yt is the m-dimensional observed response vector, where m = numseries.

  • Φ1,…,Φp are the m-by-m AR coefficient matrices of lags 1 through p, where p = numlags.

  • c is the m-by-1 vector of model constants if IncludeConstant is true.

  • δ is the m-by-1 vector of linear time trend coefficients if IncludeTrend is true.

  • Β is the m-by-r matrix of regression coefficients of the r-by-1 vector of observed exogenous predictors xt, where r = NumPredictors. All predictor variables appear in each equation.

  • zt=[yt1yt2ytp1txt], which is a 1-by-(mp + r + 2) vector, and Zt is the m-by-m(mp + r + 2) block diagonal matrix

    [zt0z0z0zzt0z0z0z0zzt],

    where 0z is a 1-by-(mp + r + 2) vector of zeros.

  • Λ=[Φ1Φ2ΦpcδΒ], which is an (mp + r + 2)-by-m random matrix of the coefficients, and the m(mp + r + 2)-by-1 vector λ = vec(Λ).

  • εt is an m-by-1 vector of random, serially uncorrelated, multivariate normal innovations with the zero vector for the mean and the m-by-m matrix Σ for the covariance. This assumption implies that the data likelihood is

    (Λ,Σ|y,x)=t=1Tf(yt;Λ,Σ,zt),

    where f is the m-dimensional multivariate normal density with mean ztΛ and covariance Σ, evaluated at yt.

Before considering the data, you impose a joint prior distribution assumption on (Λ,Σ), which is governed by the distribution π(Λ,Σ). In a Bayesian analysis, the distribution of the parameters is updated with information about the parameters obtained from the data likelihood. The result is the joint posterior distribution π(Λ,Σ|Y,X,Y0), where:

  • Y is a T-by-m matrix containing the entire response series {yt}, t = 1,…,T.

  • X is a T-by-m matrix containing the entire exogenous series {xt}, t = 1,…,T.

  • Y0 is a p-by-m matrix of presample data used to initialize the VAR model for estimation.

Version History

Introduced in R2020a