estimation of a VAR models with exogenous factors
res=varwithfac(p,listy,ARF,MAF,arg1,...,argn)
* p = a scalar, the number of lags in the VAR
* listy = a string (ny x 1) vector of names or a list of ny names, ts or vectors
* ARF =
- a (narf x 1) or (1 x narf) string vector of parameters corresponding to the AR part of the factor process
* if the user does not give in the list of variable arguments the option 'init=own', then the user can give any value to ARF; only it size matters for the estimation process
* if the user gives in the list of variable arguments the option 'init=own', then the values given by the user are used as starting values for the optimisation process
* the user must enter the empty matrix [] if she wants to impose that the AR part is empty
- a list of p elements, each element of the preceding type, and p is the # of factors to estimate
* MAF = a (nmaf x 1) or (1 x nmaf) string vector of parameters corresponding to the MA part of the factor process or a list or p elements of this type (with the same conventions as with ARF and the same number of elements as for the AR part)
* arg1,...,argn = optional arguments that can be:
- 'init=own' if the user wants to enter her own starting values
- 'Q=x' where x is a (ny+1 x ny+1) matrix of starting values for the var-cov matrix of residuals (first the residual of the factor ARMA process; note that for identification sake (see manual for details) the variance of residual of the factor ARMA process is fixed to the value given by the user in Q or to 0.25 if the user does not give starting values to Q
- 'loadings=x' where x is a (ny x 1) vector of starting values for the loadings of the factor
- 'noprint' if the user does not want to print the estimation results
- 'nap=x' with x = maximum # of calls to the function to optimize (Scilab optim option; default=1000)
- 'niter=x' with x = maximum # of iterations (Scilab optim option; default=1000)
* res = the results typed list of the dynamic factor estimation provided by the Kalman filter with:
- res('meth') = 'var with factor'
- res('y') = a (nobs x ny) matrix of observations
- res('nobs') = the # of observations
- res('ny') = the # of endogenous variables
- res('namey') = the (ny x 1) vector of names of the endogenous
- res('fac') = the estimated common factor
- res('stud fac') = the studentized estimated common factor
- res('coeff') = the (nparam x 1) vector of estimated
- res('std') = the (nparam x 1) vector of standard errors of the estimated parameters
- res('tstat') = the (nparam x 1) vector of t-stat
- res('ARF') = the (1 x narf) vector corresponding to the AR part of the factor process
- res('MAF') = the (1 x nmaf) vector corresponding to the
- res('Phi') = the estimated Phi matrix of corresponding state-measure Kalman problem
- res('H') = the estimated H matrix of corresponding
- res('Q') = the estimated Q matrix of corresponding state-measure Kalman problem
- res('R') = the estimated R matrix of corresponding
- res('C') = the (constrained) C matrix of corresponding state-measure Kalman problem
- res('D') = the estimated R matrix of corresponding
* < - res('llike') = log-likelihood of the model
- res('grad') = gradient of the log-likelihood of the
- res('AIC') = the Akaike information criterium
- res('BIC') = the Schwarz information criterium
- res('E4OPTION') = the tlist of options needed to feed the "e4" Kalman estimation
- res('prests') = a boolean indicating whether there are
- res('bounds') = bounds of the estimation (if there are ts in the regression)
- res('stdARF') = the (1 x narf) vector corresponding to the
- res('stdMAF') = the (1 x nmaf) vector corresponding to the MA part of the factor process
- res('stdPhi') = the estimated Phi matrix of corresponding
- res('stdH') = the estimated H matrix of corresponding state-measure Kalman problem
- res('stdQ') = the estimated Q matrix of corresponding
- res('stdR') = the estimated R matrix of corresponding state-measure Kalman problem
- res('stdD') = the estimated R matrix of corresponding
* < - res('theta2mat') = a string vector, collecting the commands that transform the vector of parameters into the matrices of the Kalman filter
- res('neqs') = a scalar, the number of endogenous
- res('nlag') = a scalar, the number of lags in the VAR
- res('VAR nvar') = a scalar, the number of exogenous
- res('VAR sigma') = a (neqs x neqs) matrix, the variance the residuals of the VAR
- res('VAR ser') = a (neqs x 1) vector, the standard errors
- res('VAR beta') = a (nvar x neqs) matrix, the estimated coefficients of the VAR
- res('VAR tstat') = a (nvar x neqs) matrix, the Student
- res('VAR pvalue') = a (nvar x neqs) matrix, the corresponding p-values
- res('VAR rsqr') = a (neqs x 1) vector, the R-squared
- res('VAR rbar') = a (neqs x 1) vector, the adjusted R-squared of the equations of the VAR
- res('VAR overallf') = a (neqs x 1) vector, the F statictics of nullity for all non-constant variables in the equations of the VAR
- res('VAR pvaluef') = a (neqs x 1) vector, the corresponding p-values
- res('VAR nx') = a (neqs x 1) vector, the number of exogenous variables in the VAr (constant + factors)
- res('VAR namex') = a (nexo x 1) vector, the names of exogenous variables in the VAr (constant + factors)
- res('VAR prescte') = %t (indicating the presence of the constant in the VAR)
- res('VAR dw') = a (neqs x 1) vector, the Durbin-Watson of the VAR equations
u=grand(250,1,'nor',0,1); v=grand(250,3,'nor',0,1); f=zeros(251,1); y1=zeros(251,1); y2=zeros(251,1); y3=zeros(251,1); for i=2:250 f(i+1)=0.9*f(i)+u(i); y1(i+1)=-0.2*y1(i-1)+0.7*y1(i)+0.1*y2(i)+0.1*y3(i)+0.02*f(i+1)+0.01*v(i,1); y2(i+1)=-0.3*y2(i-1)+0.4*y1(i)+0.4*y2(i)+0.015*f(i+1)+0.01*v(i,2); y3(i+1)=-0.2*y3(i-1)+0.4*y1(i)+0.4*y3(i)+0.025*f(i+1)+0.01*v(i,3); end y1=reshape(y1(52:251),'2500q1'); y2=reshape(y2(52:251),'2500q1'); y3=reshape(y3(52:251),'2500q1'); res=varwithfac(2,['y1';'y2';'y3'],'0.9',[]) | ![]() | ![]() |