Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Employing Extended Kalman Filter in a Simple Macroeconomic Model Levent Özbek*, Ümit Özlale** and Fikri Öztürk* *Ankara University, Faculty of Science, Department of Statistics System Modelling and Simulation Laboratory 06100 Tando an/Ankara ozbek@science.ankara.edu.tr URL: http://science.ankara.edu.tr/~ozbek ** Bilkent University, Department of Economics 06800, Bilkent, Ankara ozlale@bilkent.edu.tr Abstract In this study, the estimation power of Extended Kalman Filter is tested within a simple Keynesian macroeconomic model. After the model is written in a non-linear state space form, Extended Kalman Filter emerges as the appropriate methodology to estimate both state variables and the parameters. The simulation results suggest that such a methodology can also be employed in explaining more complex macroeconomic dynamics. JEL Classification: C15, C16 Keywords: Extended Kalman Filter 54 Levent Özbek, Ümit Özlale and Fikri Öztürk / Central Bank Review 1 (2003) 53-65 1. Introduction Kalman Filter has been extensively used in recent economics literature as a recursive estimation technique. It is a powerful algorithm, which can be easily employed in linear state space models, as noted in (Harvey 1990). Recently, (Ljungqvist and Sargent 2000) make usage of this method in various dynamic macroeconomic models. However, Kalman Filter fails to be appropriate in cases of non-linear state space forms. In this context, Extended Kalman Filter (EKF henceforth) has been proposed as the only possible algorithm. Although powerful, EKF has only been employed in a few studies such as (Grillenzoni 1993) and (Tanizaki 2000), where the main motivation was to compare the effectiveness of EKF with other possible solution algorithms. This paper employs the above-mentioned EKF within a simple ad-hoc Keynesian model with no microeconomic foundations. Although the model is highly stylized, it is the first attempt of its rank for Turkish economy, which presents encouraging results of EKF algorithm to be used in future studies. In addition, such a preliminary exercise also allows us to test the estimation power of EKF. The simulation results show that the parameters of the model are very close to their expected values and all of the simulated series are successfully estimated. Such a result implies that EKF can be viewed as a promising estimation technique to be employed in more realistic models with real-time data applications. The outline of the paper is as follows: The next section introduces non-linear state space models and EKF in details. Next, the simple macroeconomic model along with its implications is discussed. Then, the simulation results are displayed. The final section concludes. 2.1. Discrete-Time Linear State Space Model Discrete-time linear state space models have been employed in 1960’s mostly in controlling and signalling processes in defence industry. The extension and application of such models in other fields have taken place in the beginning of 1990s. Some of these studies include (Chui and Chen 1991), (Efe and Ozbek 1999), (Ozbek 2000,2001), and finally (Durbin and Koopman 2001). A general state space model takes the following form: x k +1 = Φ k x k + G k w k (1) Levent Özbek, Ümit Özlale and Fikri Öztürk / Central Bank Review 1 (2003) 53-65 yk = Hk xk + vk 55 (2) ∈ℜ n represents the state vector while yk ∈ℜ m represents the observation vector. Φ k is the nxn system transition matrix, H k is the mxn n m observation matrix. wk ∈ℜ and v k ∈ℜ are white noises with zero mean, for which the following assumptions can be made for each k , j values: Here, xk Moreover, for E vk = 0 (3) E wk = 0 (4) E vk v ′j = Rk δ kj (5) E wk w′j = Qk δ kj (6) E vk w ′j = 0 (7) E x0 = x0 (8) E ( x0 − x0 )( x0 − x0 ) ′ = P0 (9) E x0 wk′ = 0 (10) E x0vk′ = 0 (11) k = 0, 1, 2 ,... Φ k , H k , Gk , Qk and Rk are assumed to be known. As introduced in (Jazwinski 1970), the filtering problem is to estimate the state vector xk , given the observation vector Yk = { y 0 , y1 ,..., y k } , which can be denoted as: xˆ k k = E [xk y 0 , y1 ,..., y k ] = E [x k Yk ] with the covariance matrix: [ Pk k = E ( x k − x k k )( x k − x k k ) ′ Yk Let the observation matrix take the form: estimating the state vector xk will be as [ ] Yk −1 = { y 0 , y1 ,..., y k −1 } , then ] [ x k k −1 = E x k y 0 , y1 ,..., y k −1 = E x k Yk −1 with the covariance matrix ] 56 Levent Özbek, Ümit Özlale and Fikri Öztürk / Central Bank Review 1 (2003) 53-65 [ Pk k −1 = E ( x k − x k k −1 )( x k − x k k −1 ) ′ Yk −1 ] In this case, the Kalman Filter, depending on the starting values P0 −1 = P0 x 0 −1 = x 0 is characterized by the following algorithms: x k k −1 = Φ k −1 x k −1 k −1 (12) [ x k k = x k k −1 + K k y k − H k x k k −1 Kk = Pk k −1 Hk′ Hk Pk k −1 Hk′ + Rk ] −1 (13) (14) Pk k = I − Kk Hk Pk k −1 (15) Pk k −1 = Φ k −1 Pk −1 k −1Φ ′k −1 + Gk −1Qk −1Gk′ −1 (16) As described in (Anderson and Moore 1979) and (Chen 1993), equation (14) is also known as the “Kalman Gain”. 2.2. Non-Linear State Space Models and EKF A non-linear state space model takes the form of xk +1 = f k ( xk ) + H k ( xk ) ξ k (17) yk = g k ( x k ) + ηk (18) f k and g k are vector-valued functions, while ξ k and ηk represent white noise processes with the covariance matrices, Qk and Rk , respectively. The starting Here, values for the EKF algorithm are: P0 = cov( x0 ) xˆ 0 = E ( x0 ) As mentioned in (Chui and Chen 1991) and (Chen 1993), for k = 1, 2 ,... ′ Pk k −1 ∂f ∂f = k −1 ( xˆ k −1 ) Pk −1 k −1 ( xˆ k −1 ) + H k −1 ( xˆ k −1 )Qk −1 H k′ −1 ( xˆ k −1 ) ∂x k −1 ∂x k −1 (19) 57 Levent Özbek, Ümit Özlale and Fikri Öztürk / Central Bank Review 1 (2003) 53-65 xˆ k k −1 = kf −1 ( xˆ k −1 ) Kk = Pk k −1 (20) ′ ∂g k ( xˆ ) ∂x k k k −1 ∂g k ∂g k ( xˆ k k −1 ) Pk k −1 ( xˆ ) + Rk ∂x k ∂x k k k −1 −1 (21) ∂g k ( xˆ ) Pk k −1 ∂x k k k −1 (22) xˆ k k = xˆ k k −1 + Kk y k − g k ( xˆ k k −1 ) (23) Pk = I − Kk [ ] represent the EKF updating equations. In order to apply EKF, the matrices in the state space model above should be written as the functions, which depend on the unknown parameter vector, θ . That is, let the matrices be represented as Φ k ( θ ) , Gk ( θ ) , H k ( θ ) . Furthermore, let θ be a random walk process. In this case the following equations, xk +1 = Φ k (θ k ) xk + Gk (θ k ) wk (24) yk = H k ( θ k ) x k + vk (25) and the parameter vector θ k +1 = θ k + ζ k (26) form the new state space model: x k +1 θ k +1 = Φ k (θ k ) x k θk + y k = [H k (θ k ) 0] Gk (θ k ) wk ζk xk θk + vk The above model is non-linear for which EKF can be readily applied. (27) (28) ζk in equation (26) shows the white noise process for which the covariance matrix is assumed to be cov(ζ k ) = S k = S > 0 . In the particular case where S = 0 , the parameter vector is assumed to be time-invariant, where EKF cannot be operative. If EKF algorithm is applied to equations (27)-(28), depending on the following starting values 58 Levent Özbek, Ümit Özlale and Fikri Öztürk / Central Bank Review 1 (2003) 53-65 xˆ 0 E ( x0 ) cov( x0 ) 0 and P0 = = 0 S0 E (θ 0 ) θˆ0 for k = 1, 2 ,... we get: xˆ k k −1 θˆk k −1 Pk k −1 = Φ k −1 ( (29) k −1 ) ( ) ∂ ∂ Φ k −1 (θˆk −1 ) xˆ k −1 Φ k −1 (θˆk −1 ) Φ k −1 (θˆk −1 ) xˆ k −1 k −1 ) P ∂θ k −1 ∂θ (θˆ 0 Φ k −1 (θˆk −1 ) xˆ k −1 θˆ = I + 0 I G k −1 (θˆk −1 )Qk −1G k′ −1 (θˆk −1 ) 0 0 S k −1 [ ][ ] (30) [ ] ′ ′ Kk = Pk k −1 H k (θˆk −1 ) 0 H k (θˆk −1 ) 0 Pk k −1 H k (θˆk −1 ) 0 + Rk [ [ ]] Pk = I - Kk H k (θˆk −1 ) 0 Pk k −1 xˆ k k −1 xˆ k = + Kk y k − H k (θˆk −1 ) xˆ k k −1 θˆk θˆk k −1 [ [ −1 (31) (32) ] (33) The algorithm above has the potential to be used in many non-linear processes. The previous studies that have used EKF both in statistics and economics include (Ljung and Söderström 1983), (McKiernan 1996), (Bacchetta and Gerlach 1997), (Ozbek and Efe 2000, 2003). It should also be mentioned that, convergence problem in EKF may exist, for which (Aliev and Ozbek 1999) and, (Reif et al. 1999) propose answers for. 3. The Macroeconomic Model and the State-Space Representation The estimation methodology that has been introduced above has not been employed within the context of a macroeconometric model in prevous studies. Therefore, in this section, a simple macroeconomic model will used to test the effectiveness of EKF algorithm in such a setting. A highly stylized Keynesian ′ Levent Özbek, Ümit Özlale and Fikri Öztürk / Central Bank Review 1 (2003) 53-65 59 model without any microeconomic foundations is employed for this purpose. This framework views interest rates as primary policy variable and takes government expenditures along with taxes as given. The model can be presented as: Let yk : Output at time k ck : Consumption at time k ik : Investment at time k g k : Government expenditures at time k Furthermore, let consumption expenditures be related to the lagged values of output, and assume that investment is a function of the change in the consumption for the previous year. These two assumptions make perfect sense: an increase in output will lead to an increase in income, which, in turn affects the consumption positively. Also, investments adjust to meet the new level of consumption demand. Finally, let government expenditures follow a random walk. Formally, c k = ay k −1 , a > 0 ik = b(c k − c k −1 ) , b > 0 y k = c k + ik + g k g k = dg k −1 + wk , d > 0 Consistent with the previous explanation about consumption and investment equations, the parameters “a”, which is a measure of marginal propensity to consume, and “b”, which shows the sensitivity of investment to lagged consumption change are expected to be positive. For simplicity, we employ a closed economy model. In order to present the model in state-space form, we can rewrite the equations as y k = ay k −1 + b(ay k −1 − ay k − 2 ) + g k y k − (a + ab) y k −1 + aby k − 2 = g k c k +1 = ay k y k +1 = c k +1 + ik +1 + g k +1 = c k +1 + b(c k +1 − c k ) + g k +1 = (1 + b)ay k − bc k + g k +1 60 Levent Özbek, Ümit Özlale and Fikri Öztürk / Central Bank Review 1 (2003) 53-65 Next, we can form the state and observation matrices as c k +1 0 y k +1 = − b 0 g k +1 y k = [0 a 0 ck (1 + b ) a 0 d d y k + 1 wk 1 gk 0 (34) ck 1 0] y k (35) + vk gk In order to estimate the state variables and the unknown parameters in equation (34), we construct the parameter vector in equation (26) as θ k = [a b d ]' and form the state-space model in equations (27) and (28). After taking the derivatives, EKF algorithm that is specified in equations (29) through (33) is applied. 4. Simulation In simulation, to generate data from equations (34) and (35), the following starting values for parameters and variances of the disturbances are taken: [c0 ′ g 0 ] = [10 10 10] y0 a = 0.6, b = 0.6, d = 1.01 var(wk ) = 1 var(v k ) = 1 where wk : N (0,1) and v k : N (0,1) are generated from a Gaussian distribution. The values, which are necessary to employ the EKF updating equations (29) through (33), are taken as: xˆ 0 θˆ 0 17 2 P0 = = 5 15 10 Qk = 100 , , 0 .5 0 .5 0 .7 0 0 30 0 0 0 2 0 11 2 Rk = 10 , S 0 = I 3 x3 S k = 0.0001.I 3 x 3 , Levent Özbek, Ümit Özlale and Fikri Öztürk / Central Bank Review 1 (2003) 53-65 61 In figures 1, 2, and 3, the data that has been generated from the model are displayed along with the estimations that have been obtained via EKF. Also, the recursive estimates for the parameters can be seen in figures 4, 5 and 6. Figure 4 implies that the parameter “a” takes values between 0.45 and 0.65, which makes sense as a measure of marginal propensity to consume. The parameter “b”, on the other hand, can be viewed as being stable around 0.5 after a sharp drop in the first 10 periods. Finally, in figure 6, parameter “d” in the equation for government expenditure has been stable around 1, consistent with the random walk assumption. As a result, it will not be wrong to claim that the recursive estimates for the parameters are meaningful and the estimated state variables are very close to their simulated values. 5. Results In this study, a simple ad-hoc Keynesian model has been employed to test the estimation power of Extended Kalman Filter, which is the appropriate methodology to be used in non-linear state space models. Although the model can be criticized for being too stylized, it is the first attempt to estimate a macroeconometric model for the Turkish economy using Extended Kalman Filter. The results obtained from the simulation exercise show that the estimated state variables are very close to the simulated series, and the recursive parameter estimates are fairly reasonable. These findings suggest that the estimation methodology that has been introduced in this study has the potential to be used in more complex and realistic models with realtime data applications. 62 Levent Özbek, Ümit Özlale and Fikri Öztürk / Central Bank Review 1 (2003) 53-65 References Aliev, F. and Ozbek L. 1999. Evaluation of Convergence Rate in the Central Limit Theorem for the Kalman Filter. IEEE Trans. Automatic Control 44(10): 1905-1909. Anderson, B. D. O. and. Moore, J.B. 1979. Optimal Filtering. Prentice Hall. Bacchetta, P. and Gerlach, S. 1997. Consumption and Credit Constraints: International Evidence. Journal of Monetary Economics 40(2): 207-238. Chen, G., 1993. Approximate Kalman Filtering. World Scientific. Chui, C. K. and Chen, G. 1991. Kalman Filtering with Real-time Applications. Springer Verlag. Durbin, J. and Koopman, S.J. 2001. Time Series Analysis by State Space Methods. Oxford University Press. Efe, M. and Ozbek, L. 1999. Fading Kalman Filter for Manoeuvring Target Tracking. Journal of the Turkish Statistical Assocation 2(3): 193-206. Grillenzoni, C. 1993. ARIMA Processes with ARIMA Parameters. Journal of Business and Economic Statistics 11(2): 235-250. Harvey, A. C. 1990. Forecasting, Structural Time Series Models and the Kalman Filter. Cambridge: Cambridge University Press. Jazwinski, A. H. 1970. Stochastic Processes and Filtering Theory. Academic Press. Ljung, L. and Söderström, T. 1983. Theory and Practice of Recursive Identification. Cambridge, Mass: MIT Press. Ljungqvist L. and Sargent T. 2000. Recursive Macroeconomic Theory. MIT Press. McKiernan, B. 1996. Consumption and the Credit Market. Economics Letters 51(1) (April): 83-88. Ozbek, L. 2000. Durum-Uzay Modelleri ve Kalman Filtresi. Gazi Ünv. Fen Bilimleri Ens. Dergisi 13(1): 113-126. . 2001. Sistem Tanılamada Uyarlanır Kalman Süzgeci ve Sıcaklık Denetimi çin Bir Uygulama Çalı ması. Galatasaray Ünv. Mühendislik Bilimleri Dergisi 1(2): 15-28. Ozbek, L and Efe, M. 2000. Online Estimation of the State and the Parameters in Compartmental Models Using Extended Kalman Filter. In the book, Nonlinear Dynamics in the Life and Social Sciences. Editors: Sulis, W.H. and Trofimova, I. pp 262-274, IOS Press. . 2003. An Adaptive Extended Kalman Filter with Application to Compartment Models. Communication in Statistics-Simulation and Computation, forthcoming. Reif, K. and Unbehauen, R. 1999. The Extended Kalman Filter as an Exponential Observer for Nonlinear Systems. IEEE Trans. Signal Processing 47(8): 2324-2328. Reif, K., Gunther, S., Yaz, E. and Unbehauen, R. 1999. Stochastic Stability of the Discrete-Time Extended Kalman Filter. IEEE Transactions on Automatic Control 44(4): 714-728. Tanizaki, H. 2000. Nonlinear and Non-Gaussian State-Space Modeling with Monte Carlo Techniques: A Survey and Comparative Study. Kobe University, Faculty of Economics Working Paper. 63 Levent Özbek, Ümit Özlale and Fikri Öztürk / Central Bank Review 1 (2003) 53-65 Fig. 1. Consumption and Its Estimate 80 70 60 50 40 30 20 Estimate 10 Real Value 120 127 113 99 106 92 85 78 71 64 57 50 43 36 29 22 15 8 1 0 time Fig. 2. Output and Its Estimate 140 120 100 80 60 40 Estimate 20 Real Value tim e 129 121 113 105 97 89 81 73 65 57 49 41 33 25 17 9 1 0 64 Levent Özbek, Ümit Özlale and Fikri Öztürk / Central Bank Review 1 (2003) 53-65 Fig. 3. Government Exp. and Its Estimate 60 50 40 30 20 Estimate 10 Real Value 127 113 120 106 99 92 85 78 71 64 57 50 43 36 29 22 8 15 1 0 time Fig. 4. Parameter 'a' 0,7 0,6 0,5 0,4 0,3 0,2 0,1 Parameter 'a' 127 120 113 99 92 85 78 106 time 71 64 57 50 43 36 29 22 15 8 1 0 65 Levent Özbek, Ümit Özlale and Fikri Öztürk / Central Bank Review 1 (2003) 53-65 Fig. 5. Parameter 'b' 0,6 0,5 0,4 0,3 0,2 0,1 Parameter 'b' 120 127 113 99 106 92 85 78 71 64 57 50 43 36 29 22 15 8 1 0 time Fig. 6. Parameter 'd' 1,4 1,2 1 0,8 0,6 0,4 0,2 Parameter 'd' time 127 120 113 106 99 92 85 78 71 64 57 50 43 36 29 22 15 8 1 0 66 Central Bank Review 1 (2003) This page left intentionally blank. View publication stats