The four variables we are talking about are in y_t (nx1) and we have a vector of x_t where there are variables affecting only y_t (a particular element) and h_t is the common. The observables are in the y_t and the non observables are in h_t.

We are saying that there is something not observable which is in h_t.

What is the difference between PCA and Kalman Filter?

In PCA you obtain something common to all the variables, but this common element does not contain any dynamic. It is just static. The Kalman Filter allows us to impose dynamics to the unobserved.

\[ y_t = A'x_t + H'h_t +w_t \\ h_{t+1} = Fh_t + v_{t+1} \]

Aplication 1: Decompostion of real GDP in permanent and transitory part (Clark, 1987)

\[ y_t = n_t + x_t \]

Suppose you want to decompose the real GDP in potential output (n_t) and ouptut gap (x_t)

We assume that the potential output n_t has a unit root and the output gap (x_t) follow a AR(2)

In this case we only have one observable (log of gdp) and we have to unovervables.

Potential Output

\[ n_t = g_{t-1} + n_{t-1} + v_t \]

The potential output (n_t) contains a unit root, becasue it is a function of things that change slowly over time (capital, knowledge)…

Assume that the constant (g_t-1). Variation in potential ouptut has a constatn (productividty) which is a constant which moves slowly over time (g_t-1).

\[ n_t = g_{t-1} + n_{t-1} + v_t \\ g_t = g_{t-1} + w_t \]

We always have to write the state space representation (in matrix form). To do so:

  1. What are the observable? In this case the observable is log of GDP.
  2. What are the unobservables? The potential gdp and the transitory compontent.

\[ y_t = (1,1)\begin{bmatrix} n_t \\ x_t \end{bmatrix} \]

There is no way to write \(n_t , x_t\) as function of its lags. How can you solve this problem. When you need more than one lag you need to enalrge the model adding lags.

\[ y_t = [1, 1, 0,0]\begin{bmatrix} n_t \\ x_t \\x_{t-1} \\ g_t \end{bmatrix} \]

$$

\[\begin{bmatrix} n_t \\ x_t \\x_{t-1} \\ g_t \end{bmatrix}\]

=

\[\begin{bmatrix} 1 & 0 & 0 & 1 \\ 0 & \phi_1 & \phi_2 & 0 \\ \end{bmatrix}\]

$$

Aplication 2: Decompostion of real GDP in permanent and transitory part (Clark, 1987)

The four variables have something in common (C_t) and this somethonig in commong follow an AR(2). This foru variables, its idosincatitc part (e_it) also follow a AR(2). Which means that Industrial Production

Why is it written as differences from the constnat (delta). What is the regression between the constant of the AR(2) and that delta. The first homework is the relatinonhsip between the Phi and the delta.

Delta is the expeceted value of the of the AR.

Identification problem

We say that the variables contain a constnat, bu the the factor also has a constnat. We have 5 contants to match 4 expected values.

First we will identify a model without the means. We will demean the fuoru growth rates.

There is typo.

Why AR(2)? This is explained in addiotnal material of class.

In a AR(1) its IRF, an AR(2) depending on the roots of the polynomial can be writen as sin(X) and cos(x). Why? Because depending of the roots of the poolyinomail you can have imaginary parts. Therefore the AR(2) is the more parsimonuso way to represent a rich class of IRF.

Intermediate steps for state space representation (standard question in the exam)

We have four variables which are functions of a factor. We have a factor that follows a AR(2) and a idiosincratic shock that also follows a AR(2)

What are the observables?

The growth of y from 1 to 4.

What are the non observables?

The factor

To write the model we have to write the observables as function of the non-observables. And th non-observables have to follow a AR(1) .

With a AR(1) I can not write an AR(2), we have to lag the unobservable.

The errors also follow a dynamic. That is the reason we have to enlarge the model.

Kalman Filter - Summary

Reading the 8 lines.

I want to write my model in the state space representation. The idea is that we have 4 variables (IPI, Sales …). Everytime we have something we can not see we use Kalman Filter.

We have 4 time series. What is the intuituiton of the filter? We have a set of series with noises and we want to filter the common signal. What is the common signal? The business cycle. We want to clean the data.

We have the model in state space representation. How can we get the info?

In the state space representation there are a set of thing we do not know, the parameters and the variances.

For every iteration we can extract the information.

Prediction

At the beginning of the time we have to make two assumptions.

First, what is \(h_{0,0}\) what is the state of the economy at the beginning, with no information. For the first observation I want to know what is the expected value of the transition vector. I will assume it is normalized. So \(h_{0,0}=0\) they are at its mean (0). And about the uncertaintiy I will assume it is \(P_{0,0}= I = IdentityMatrix\)

Next I have to saay waht is the expected value of \(h_{1|0}\) it is the \(Fh_{0|0}\)

What is the expected uncertaity (variance).

The second line uses properties of the vectors. \(P\) is the variance covariance matrix of \(h\).

\[E(y_1|0)= A'x_1 + H'E(h_1|0) \]

\[ E(y_1|0)= A'x_1 + H'h_{1|0} \]

What is the value of h_1|0

\[ h_{1|0} = Fh_{0|0} \]

What is its variance covariance?

\[ P_{1|0} = F P_{0|0}F' + Q \]

Now we have to make our first forecast about the observables. Remember that in (x) we have the exogenous variables (a dummy for a strike, a dummy for the Covid pandemic)

\[ y_{1|0} = A'x_1 + H'Fh_{0|0} \]

Once I have made my forecast the variables are realease. The key thing is that we are going to be great at incorporating to add the information of this variables to the model and add. This is to add the information everyday. It is like to being able to update your forecasts during the match and not before the match stats.

What are the realeases? I observe \(y_1\) and I have four surprises or errors.

\[ y_1 = A'x_1 + H'h_1 +w_1 \\ \hat{y}_{1|0} = A'x_1 + H'h_{0|0} \]

Then the four surprises are a mix of the unovervables and the errors.

\[ y_1 - \hat{y}_{1|0} = H'(h_1 - h_{0|0}) +w_1 \]

What is the variance covariance matrix of this forecast?

\[ Var( y_1 - \hat{y}_{1|0} ) = H'P_{1|0}H + R \]

Now the important thing is how we incorporate the new information. We have seen \(y_1\), perfect, now how we update our predictions. What is \(h_{1|0}\) once we have seen \(h_{0|0}\)

Statistic refresher

Having two distributions that are normally distributed, if we observe one, the otehr variables after seen one, is a N(m,Sigma)

If you have two varaibles,  \(y_t, x_t\) the value of the \(\beta = Cov(y_t,x_t)/var(xt)\)

The second term in \(m = \mu + \Omega \Omega ^-1 (z1- \mu)\)

Wehre the begingi of the first term is the beta.

Upadate

\[ \hat{h}_{1|1} = \hat{h}_{1|0}+ P H(HPH+R)\eta \]

The second element is called the Kalman Gain.

1.2 Estimation

We are provided with a set of initial values. We will calculate errors and VCV of this errors.

About the code

In introduction 0 there is an example on how to estimate AR(1) with MLE.

Global variables: is prevents us to add all the variables in each function that we define (like the number of observations, number of rows and so on). So the global variables allows the variables to be used in other functions with out really adding them as an argument.

They are functions that will be used in the system.

The likelihood funciton is the sumation of the likelihood of every observation.

In cramer rao the inverse of the matrix is the VCV of the coefifcients.

How can I interpretate the factor?

The factor is an average, a compresion of the variables that I have in the system and it relates to monthly activity.

It does not have units.

It relates to activity, whicch is a quarter variable. How do relate a unitless monthly variable to a quarterly variable?

The relation beteween quarter effect and annual effect is complicated, becasue of the carry over effects.

The relationship between monthly and quarterly effect is also complicated.

We transform from monthly to quarterly and we renormalize, to rescale by the mean and vaariance of GDP.

What happens when we have an unbalance panel?

Direct forecasts of GDP growth?