dynamic factor analysis with the Kalman filter
res=fac_kalman(listy,ARF,MAF,listar,arg1,...,argn)
* listy = a string (ny x 1) vector of names or a list of ny names, ts or vectors
* ARF = either
- 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 grocer_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
- or 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 grocer_ARF and the same number of elements as for the AR part)
* listar = a list of n vectors with:
- n: # of y variables
* argi = optional arguments that can be:
- the string 'noprint' if the user doesn't want to print the results of the regression
- the string '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, then the ny residuals of the endogenous variables); 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
- the string 'loadings=x' where x is a (ny x 1)vector of starting values for the loadings of the factor
- the string 'nap=x' with x = maximum # of calls to the function to optimize (Scilab optim option; default=1000)
- the string 'niter=x' with x = maximum # of iterations (Scilab optim option; default=1000)
- 'optfunc=optim' if the user wants to use the optim optimisation function (default: optimg)
- 'opt_nelmead=crit,nitermax' with crit the value of the convergence criterion in the Nelder-Meade optimisation function and nitermax the maximum number of iterations (default = 'opt_nelmead=2*%eps,1000')
- 'opt_optim=opts' where opts are options for optim that can be entered after the starting value of the parameters (default = 'opt_optim=,''ar'',1e6,1e6'')
- 'opt_convg=val' where val is the threshold on gradient norm (default = 'opt_convg=1e-5')
* res = the results typed list of the dynamic factor estimation provided by the Kalman filter with:
- res('meth')= 'fac_kalman'
- 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 variables
- res('fac')= the estimated commun factor
- res('stud fac')= the studentized estimated commun factor
- 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 MA part of the factor process
- res('ary')= the list of ny vectors corresponding to the AR processes of the residuals of the endogenous variables
- res('Phi')= the estimated Phi matrix of corresponding state-measure Kalman problem
- res('H')= the estimated H matrix of corresponding state-measure Kalman problem
- res('Q')= the estimated Q matrix of corresponding state-measure Kalman problem
- res('coeff')= the (nparam x 1) vector of estimaredparameters (exploded in the Phi, Q and H matrices)
- res('std')= the (nparam x 1) vector of standard errors of the estimared parameters
- res('tstat')= the (nparam x 1) vector of t-stat of the estimared parameters
- res('llike') = log-likelihood of the model
- res('grad') = gradient of the log-likelihood of the model at the estimated parameters
- 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 ts in the regression
- res('bounds') = bounds of the estimation (if there are ts in the regression)
REFERENCE: Doz C. and Lenglart F. (1999): "Analyse factorielle dynamique : test du nombre de facteurs, estimation et application l'enquete de conjoncture dans l'industrie", Annales d'Economie et de Statistique, n. 54.
load(GROCERDIR+'/data/BusinessSurvey.dat'); bounds('1976m3','1997m3') [r]=fac_kalman(['pp';'fp';'gob';'fob';'in';'gpp'],string([0.9;0]),'0',list('0.1','0.1','0.1','0.1','0.1','0.1')) // Example taken from fac_kalman_d(): it provides the estimation of the original Doz and Lenglart estimation. [r]=fac_kalman(['pp';'fp';'gob';'fob';'in';'gpp'],string([-1.83;0.85]),'-0.48',list('0.33','0.81','0.88','0.87',... '0.82','0.89'),'init=own','Q=diag([0.5;2.55;3.23;2.55;3.94;2.83;5.95].^2)','loadings=[2.76;1.96;3.17;3.25;-1.61;3.69]',... 'noprint','nap=100','niter=100') // Performs the same estimation, except that the user gives her own starting values, // taken here from Doz and Lenglart paper ([-1.83;0.85] for the AR part of the factor process, // -0.48 for its MA part, 0.33,0.81,0.88,0.87,0.82,0.89 for the AR coefficients of the residuals of the endogenous variables, // the square of 2.55;3.23;2.55;3.94;2.83;5.95 for their variance //(note that Doz and Lenglart' present the standard errors whereas GROCER needs variances); // the maximum # of calls to the optimization function as well as the maximum # of iterations is set to 100. // The results are not printed (option 'noprint') but saved in the tlist r, so that they can be printed later. | ![]() | ![]() |