# Have I used correct state space formulation of Bivariate Trending OU process for Kalman Filter estimation?

Introduction

I'm trying to estimate the parameters of an Ornstein Uhlenbeck process for a risky asset using the Kalman Filter but have doubts about the state space formulation that I am using. Also, though the optimization routine usually converges, it is not producing consistent results (I seed it using random values of a0). I set out the state space formulation below and a sample of the results that I've obtained. I'd be grateful for comments.

Background:

Lo and Wang's 1995 paper "Implementing Option Pricing Models When Asset Returns Are Predictable" talk about a bivariate trending Orstein Ulhlenbeck process. Formulae 47 and 48 in the paper re-expresses the SDE in discrete form as follows: Note that the Xk series is not observable in the case that I am considering.

Also note that Lo and Wang suggest that "the parameters of this discrete-time process may be estimated by maximum likelihood by casting equation (51) in state space form and applying the Kalman Filter". (Equation 51 is simply equations 47 and 48 written in vector form.)

State Space formulation:

We've around 200 observations of returns in the qk series which are the result of taking the log of the original price series and removing the mean.

I've used the following state space formulation for the Kalman filter: Question: Does this look right to you?

Results using FKF

I've used the R FKF and optim routines but do not seem to get stable results.

Here are examples of the output

Run 1:

gammaA     deltaX      lamda     sigmaQ     sigmaA


1.22281609 -0.02375487 0.82993795 -0.20981042 0.33695527

Hessian

      gammaA     deltaX       lamda    sigmaQ      sigmaA


gammaA 145811.12 -59698.72 233025.83 4081125.686 -108014.073
deltaX -59698.72 1417438.95 245361.72 -115470.817 -77597.375
lamda 233025.83 245361.72 -66780.33 828819.093 -155588.44
sigmaQ 4081125.69 -115470.82 828819.09 -140434.978 -2393.24
sigmaA -108014.07 -77597.38 -155588.44 -2393.245 9394.849

Run 2:

gammaA      deltaX       lamda      sigmaQ      sigmaA


-0.2588449 -0.6517501 0.4049603 0.2003555 -0.3892163

Hessian

        gammaA     deltaX       lamda     sigmaQ      sigmaA


gammaA -10649.06 298063.86 -1874109.00 -3086410.1 182300.504
deltaX 298063.86 111453.96 -65612.75 -170051.6 26122.721
lamda -1874109.00 -65612.75 -401617.84 304812.4 101798.308
sigmaQ -3086410.07 -170051.55 304812.40 337275.3 1084290.034
sigmaA 182300.50 26122.72 101798.31 1084290.0 1605.492

Obviously, apart from the stability problems, we have a problem with negative values of the sigmas, which are the volatilities of the process.

The Hessian is used to determine the confidence intervals for the estimates, and it is such that there are NaN's for some confidence intervals. However, that is not the focus for the moment.

Question: Any comments on these results and what might be going wrong?

I've worked on this further and have the following thoughts:

1. A better formulation of the state space equation (sse) is of the form: (Yes, the matrices don't conform in the typesetting above. Sorry.)

The FKF package in R seems to force one to use the cumbersome formulation that I set out at the top.

Matlab allows the briefer formulation set out immediately above.

1. Simulating the process from the sse above and then trying to fit it is a useful way of diagnosing problems. For the values I've investigated, the Kalman Filter with MLE methods did not work properly, either with R's FKF or Matlab.