Processing math: 100%

Implementation of news analysis in JDemetra+

The weights associated to each piece of news are calculated as follows:

[wk,h1wk,hJ]w=E[yk,t+hI]AE[II]1(LL)1

In order to calculate the weights, we use the Kalman smoother for the determination of the precision matrices, which are an essential part of the formula:

  • The covariance between the target variable and the news vector has the following form:
E[yk,t+hI]=[ΛkE[(ftkE[ftk|Fold])(ft1E[ft1|Fold])]Λi1ΛkE[(ftkE[ftk|Fold])(ft2E[ft2|Fold])]Λi2ΛkE[(ftkE[ftk|Fold])(ftJE[ftJ|Fold])]ΛiJ]
  • The covariance of the news vector can be written as follows:
E[II]j,l=ΛijE[(ftjE[ftj|Fold])(ftlE[ftl|Fold])]Λil+E[eij,tjeil,tl]

Our implementation can be summarized in a few simple steps:

  1. computeNewsCovariance() computes a lower-triangular matrix lcov_, which is the Choleski factor of E[II]

  2. weights(int series, TsPeriod p) first stores E[yk,t+hI] in a DataBlock a, and then it solves the system without the need to invert E[II]

  3. The weights are computed by solving two systems, which can be represented in matrix notation:

    • First, calculate B=wL by solving LB=A using the rsolve method contained in the class lower triangular
    • Second, calculate w by solving wL=B using the lsolve method