Processing math: 100%

Estimation of dynamic factor models in JDemetra+

Expectations-Maximization (EM) algorithm (DfmEM)

Remember the modeling framework:

yt=Λft+ψt,with ψtN(0,Rψ)ft=A1ft1++Apftp+ut,with utN(0,Q) where ψt represents the measurement error, which is assumed to be independent from the factor innovations ut.

The EM algorithm can be used to obtain initial values that will be fed into the numerical optimization procedures described below. The algorithm works by iterating two steps. The EStep() (expectation step)
runs the Kalman filter recursions and compute the likelihood, while the MStep() (maximization step), new parameter values are computed. The new parameter values obtained at each maximization step are calculated by solving the first order conditions for Λ, R, A and Q with respect to the joint log likelihood of the data and the factors (resource).

log(fp+1,,f0,f1,,fT,y1,,yT|θ)=12log|ˉQ0|12ˉf0ˉQ10ˉf0T2log|Q|12tr[Q1Tt=1(ftAˉft1)(ftAˉft1)]T2log|Rψ|12tr[R1ψTt=1(ytΛft)(ytΛft)]

where $\bar{f}{t}isavectorcontainingthefirstplagsoff{t}withaparametersvector\theta=\bar{f}{0},\bar{Q}{0},Q,A, R_{\psi},\Lambda.NotethatA=[A_{1}\ldots A_{p}]$ and it is therefore different from the transition matrix of the state-space representation of the model.

The equations resulting from the M-step at each iteration i follow. Note that they are calculated under the assumption that the initial conditions are given ( i.e. $ \bar{f}{0},\bar{Q}{0}$ are fixed):

A(i)=(Tt=1Eθ(i1)[ftˉft1|ΩT])(Tt=1Eθ(i1)[ˉft1ˉft1|ΩT])1Λ(i)=(Tt=1Eθ(i1)[ytft|ΩT])(Tt=1Eθ(i1)[ftft|ΩT])1Q(i)=(1TTt=1Eθ(i1)[ftft|ΩT]AiTt=1Eθ(i1)[ft1ft|ΩT])R(i)ψ=diag(1TTt=1Eθ(i1)[ytyt|ΩT]ΛiTt=1Eθ(i1)[ftyt|ΩT])

Missing Values

In the presence of missing values, the loadings matrix Λ(i) and R(i) are calculated for each variable by using only the periods of time for which data is available. That means that if a variable does not exist for a given period t, both components of the formula for Λ(i) will not be used for that period.

Restrictions in the parameters

  • The loadings for quarterly variables, for example, load on a weighted average of the factors. For those variables, the formula is almost the same as above with only one difference: the above expectations containing montly factors are replaced by an equivalent expression where the factors are quarterly. That is: fQt=13ft+23ft1+ft2+23ft3+13ft4

  • When a model has a lower triangular matrix for the transition matrix, equating to zero the derivative of expression (???) with respect to the lower triangular part yields a similar outcome as expression (6):

A(i)=lowerTriang{(Tt=1Eθ(i1)[ftˉft1|ΩT])(Tt=1Eθ(i1)[ˉft1ˉft1|ΩT])1}
  • When the model contains a block of variables $y^{e}{t}thatreflectexpectationsaboutthefuture,( y^{e}{t} =[y^{e}{u,t}: y^{e}{\pi,t} ]^{‘}),wherey^{e}{u,t}andy^{e}{\pi,t}representhmonthsaheadforecastsforunemployment(u_{t+h|t})andinflation(\pi_{t+h|t}),respectively.Thismeansthelikelihoodformula(???)ismodifiedasfollows$ \begin{align} log &\quad & \ell(f_{0}, f_{1}, \ldots, f_{T}, y_{1},\ldots, y_{T}|\theta)= \nonumber
    &-& \frac{1}{2} log \left|Q_{0}\right| - \frac{1}{2} f^{‘}_{0}Q^{-1}_{0} f_{0} - \frac{T}{2} log \left|Q\right| - \frac{1}{2}\mathrm{tr}\left[ Q^{-1}\sum^{T}_{t=1} (f_{t}-A \bar{f}_{t-1})(f_{t}-A \bar{f}_{t-1})^{‘}\right] \nonumber
    &-& \frac{T}{2} log \left|R_{\psi}\right| - \frac{1}{2}\mathrm{tr}\left[ R_{\psi}^{-1}\sum^{T}_{t=1} (y_{t}-{\color{blue}\Lambda^{
    }} f_{t})(y_{t}-{\color{blue} \Lambda^{}} f_{t})^{‘}\right]
    \label{like2} \end{align
    } $where the factor loadings corresponding to

yt=(yu,tyπ,tyeu,tyeπ,t) are equal to Λ=[ΛuΛπΛuAhΛπAh]

  • By noticing that Ah enters the factor loadings for variables reflecting expectations, the derivative of the likelihood with respect to A will be more complex. Note that
trace(ftAh)A=h1r=0(ArftAh41)

, so we can obtain a new formula where solving the first order condition for A would become much more complex whenever h>2. Thus, we propose to replace this step by a directly numerically maximizating the likelihood with respect to A, keeping the remaining parameters fixed to the values resulting from the previous iteration. Although we do not compute this formula, the EM algorithm remains valid. As opposed to the standard case, this modification in the M-step, allows us to exploit extra information contained in the likelihood function to improve the estimation of A. This affects the persistence of the variables, which is key for understanding the dynamics of the variables. In the case of inflation for example, the persistence is a key parameter that monetary policy makers look at.

  • But A also appears multiplying the loadings in the likelihood function, so the M-step for the loadings in the measurement equations needs to be modified. Consider for example inflation. The loadings associated to a variable that we think it is related to inflation expectations could be defined as follows: case 1:Λ(i)πe=(Tt=1Eθ(i1)[yeπ,tftAh|ΩT])(Tt=1Eθ(i1)[AftftAh|ΩT])1 Again, in the presence of missing values, the loadings matrix Λ(i) at each iteration i is calculated for each variable by using only the periods of time for which data is available.

  • However, the equation above does not take into account the restriction that the loadings corresponding to the inflation time series (Λπ) are related to those of inflation expectations (ΛπAh). This restriction, which helps to achieve parsimony, determines a small change in the M-step: case 2:Λ(i)π=(Tt=1Eθ(i1)[yπ,tft|ΩT]+Tk=1Eθ(i1)[yeπ,kfkAh|ΩT])(Tt=1Eθ(i1)[ftft|ΩT]+Tk=1Eθ(i1)[AfkfkAh|ΩT])1 where yπ,t stands for inflation and $y^{e}{\pi,k}representsinflationexpectationshperiodsahead.Weusedifferenttimeindicestandkasawaytounderlinethepossibilitythaty{\pi,t}andy^{e}{\pi,k}arenotnecessarilyobservableforthesameperiods.Asonecanobservebylookingatthesecondelementinsideeachparenthesisofequation(2),havingfewobservablesfortheexpectationsdatadoesnotpreventusfromobtainingestimatesof\Lambda^{(i)}{\pi}.Thereasonisthatthedatapointscorrespondingtotheactualinflationdataareinformativeabouttheloadings.Interestingly,thelargerthenumberofdatapointsfortheexpectationsdata,thelargeritsweightintheestimationof\Lambda^{(i)}_{\pi}$.

Numerical optimization methods