Estimate VARX model parameters
EstSpec = vgxvarx(Spec,Y) [EstSpec,EstStdErrors,LLF,W] = vgxvarx(Spec,Y,X,Y0,'Name1'
,Value1,'Name2'
,Value2,...);
vgxvarx
estimates parameters
of VAR and VARX models using maximum likelihood estimation.
Spec  A multivariate time series specification structure for
an ndimensional time series process, as created
by 
Y  A single path of an ndimensional
time series process with T observations for each
path, collected in a Tbyn matrix.
If 
X  Exogenous inputs. nPX paths of regression
design matrices associated with T observations
of an ndimensional time series process, where
each design matrix linearly relates nX exogenous
inputs to each time series at each observation time. 
Y0  Presample time series process. nPY0 presample
paths of an ndimensional time series process with TY0 samples
for each path, collected in a TY0bynbynPY0 array.
If 
Specify the following optional input arguments as variablelength
lists of matching parameter name/value pairs: 'Name1'
, Value1
, 'Name2'
, Value2
,
... and so on. The following rules apply when specifying parametername
pairs:
Specify the parameter name as a character string, followed by its corresponding parameter value.
You can specify parameter name/value pairs in any order.
Parameter names are case insensitive.
You can specify unambiguous partial string matches.
The following table lists valid parameter name/value pairs.
Name  Value 

'CovarType'  Form of the estimated covariance matrix.
This value overrides the value of 
'StdErrType'  Form of the estimated standard errors.

'IgnoreMA'  Use of moving average terms in the specification structure.
For example, if a VARMA (1,1) model is specified
with 
'MaxIter'  Maximum number of iterations for parameter estimation.
The default is 
'TolParam'  Convergence tolerance for parameter estimation. The default
is 
'TolObj'  Convergence tolerance for parameter estimates. The default
is 
EstSpec  A multivariate time series specification structure for
an ndimensional time series process that contains
parameter estimates for a VAR or VARX model, as created by 
EstStdErrors  A multivariate time series specification structure containing
standard errors of estimated parameters for the ndimensional
time series process The standard errors are maximum likelihood estimates, so a degreeoffreedom adjustment is necessary to form ordinary least squares estimates. To adjust standard errors for degreesoffreedom, multiply them by $$\sqrt{\frac{T}{\left(TNumActive1\right)}},$$ where T is
the number of observations of the time series process and NumActive is
the number of unrestricted parameters that 
LLF  The loglikelihood function with the maximum likelihood
estimates of the model parameters from 
W  Estimated innovations process. Since the estimation is
based on a single path of 
Start with a 2dimensional VARMA(2, 2) specification structure
in Spec
with presample data for the time series
and innovations process:
load Data_VARMA22
The process in Y
was generated with the known
specification structure in Spec
and is a VARMA(2,
2) process. Since vgxvarx
calibrates VARX models,
ignore the moving average component of the model and fit a pure VAR(2)
model as an approximation. The function vgxvarx
generates
parameter estimates in EstSpec
and standard errors
in EstStdErrors
:
[EstSpec, EstStdErrors] = vgxvarx(vgxar(Spec), Y, [], Y0);
Use vgxdisp
to display the estimated parameters
along with standard errors and tstatistics:
vgxdisp(EstSpec, EstStdErrors)
Model : 2D VAR(2) with No Additive Constant Conditional mean is ARstable and is MAinvertible Standard errors without DoF adjustment (maximum likelihood) Parameter Value Std. Error tStatistic     AR(1)(1,1) 0.850166 0.12583 6.75649 (1,2) 0.0498191 0.163542 0.304625 (2,1) 0.219381 0.0934711 2.34705 (2,2) 0.0227752 0.121486 0.187472 AR(2)(1,1) 0.294609 0.145514 2.02461 (1,2) 0.221336 0.148174 1.49376 (2,1) 0.264504 0.108094 2.44699 (2,2) 0.0819125 0.110069 0.74419 Q(1,1) 0.051844 Q(2,1) 0.00711775 Q(2,2) 0.0286081
To see qualitatively how well the VARX approximation worked,
infer the innovations process from the calibrated model and compare
with the known innovations process from the VARMA(2, 2) process in W
:
EstW = vgxinfer(EstSpec, Y, [], Y0, W0); subplot(2,1,1); plot([ W(:,1), EstW(:,1) ]); subplot(2,1,2); plot([ W(:,2), EstW(:,2) ]); legend('VARMA(2, 2)', 'VAR(2)');
Try to calibrate a VAR(2) model with a restricted model such
that the crossterms in the AR lag matrices are fixed at 0 (this model
treats each time series in Y
as a separate VAR
model but with a joint distribution for the innovations process):
SpecX = vgxset(vgxar(Spec),'AR',repmat({eye(2)},2,1), ... 'ARsolve', repmat({ logical(eye(2)) }, 2, 1)); [EstSpecX, EstStdErrorsX] = vgxvarx(SpecX, Y, [], Y0);
Compare the calibrated restricted VAR(2) model with the previous unrestricted VAR(2) model to see that the crossterms in the AR lag matrices have been fixed at 0 in the restricted model:
vgxdisp(EstSpecX, EstSpec);
Model 1: 2D VAR(2) with No Additive Constant Conditional mean is ARstable and is MAinvertible Model 2: 2D VAR(2) with No Additive Constant Conditional mean is ARstable and is MAinvertible Parameter Model 1 Model 2    AR(1)(1,1) 0.789031 0.850166 (1,2) 0 0.0498191 (2,1) 0 0.219381 (2,2) 0.284343 0.0227752 AR(2)(1,1) 0.251377 0.294609 (1,2) 0 0.221336 (2,1) 0 0.264504 (2,2) 0.178158 0.0819125 Q(1,1) 0.0541056 0.051844 Q(2,1) 0.00806393 0.00711775 Q(2,2) 0.0410274 0.0286081