Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Linear Regression via Kalman Filter

    Dear Statalist,
    I am trying to fit a linear regression model by using the Kalman filter in Stata 12.
    Since this is the first time for me working with state-space models and the Kalman filter I’m having trouble to set up the correct Stata code.


    The model to be estimated:
    Code:
    Asset_Return = Beta0 + Beta1 * Market_Return + Beta2 * Interest_Return + Error_Term
    Time series of asset returns are regressed on market return and interest return, plus a white noise error term.
    The coefficients Beta0, Beta1 and Beta2 are to be estimated via Kalman Filter.


    Stata Code used so far:
    Code:
    constraint define 1 [MB] L.MB = 1                                                                   /// Beta1 modelled as random walk
    constraint define 2 [ZB] L.ZB = 1                                                                     /// Beta2 modelled as random walk
    
    sspace  (MB L.MB, state noconstant)                                                             /// State Equation for Beta1
                 (ZB L.ZB, state noconstant)                                                               /// State Equation for Beta2
                 (AssetReturn MB ZB MarketReturn InterestReturn /*, noconstant*/),     /// Observation Equation
                 covstate (diagonal) constraints (1 2)
     
    predict Betas_V3, state equation(MB) smethod(filter) rmse(RMSE_V3)
    predict Betas_V4, state equation(ZB) smethod(filter) rmse(RMSE_V4)

    Stata output:

    Click image for larger version

Name:	Kalman.png
Views:	1
Size:	20.4 KB
ID:	1385275



    Questions:
    1. Is this the correct Stata code to estimate the model mentioned above? If not, what would the correct code look like?
      I am not sure how to account for the regressors / independent variables Market_Return and Interest Return in a correct way and how to link them to Beta1 and Beta2. Did I do it right?
    2. I expected to obtain the series of coefficients for Beta1 and Beta2 by the two -predict- commands.
      In which way do they differ from the coefficients reported in the -sspace- output or what are those coefficients from the -sspace- ouput referring to at all?
    3. Is it correct not to use a third state equation for modelling the constant Beta0, since the underlying process of the constant Beta0 is not a stochastic process and therefore the constant Beta0 is modelled by including a constant in the observation equation?


    Any help is greatly appreciated!

    Kind Regards
    Carl

  • #2
    It is impossible to apply Kalman filter to this type of simple linear regression. Use EViews command sspace to run Kalman filter. It is quite easy to run this two factor models in EVIews, although you need to be careful to give correct initial values.
    Last edited by Soichiro Moridaira; 08 Sep 2017, 00:19.

    Comment

    Working...
    X