- Details
- Parent Category: Engineering Assignments' Solutions

# We Helped With This Electrical Engineering Homework: Have A Similar One?

Category | Engineering |
---|---|

Subject | Electrical Engineering |

Difficulty | Undergraduate |

Status | Solved |

More Info | Electrical Engineering Help |

## Assignment Description

Assignment 4 - Filtering in nonlinear models

### 1 Nonlinear Models

As you noticed in the previous assignment it is important to use the right model for the given data. Typical models in finance are nonlinear. The Heston model, featuring a stochastic volatility, is a common example for describing dynamics of stocks and indexes in the market. In this assignment we will make predictions and corrections with a calibrated Heston model using nonlinear extensions of Kalman filters.

__The Heston model__:

*dS _{t }*=

*µS*+

_{t}dt^{p}

*V*

_{t}S_{t}dW_{1}(

*t*)

*,*(1)

*dV*=

_{t }*k*(

*θ*−

*V*)

_{t}*dt*+

*λ*

^{p}

*V*

_{t}dW_{2}(

*t*)

*,*(2)

where *µ*, *κ*, *θ *and *λ *are
the parameters, *S _{t }*and

*V*represent the value of the underlying asset and its volatility, respectively, while

_{t }*W*

_{1}(

*t*) and

*W*

_{2}(

*t*) are dependent Wiener processes with the correlation coefficient

*ρ*, such that

*dW*

_{1}(

*t*) ·

*dW*

_{2}(

*t*) =

*ρdt*.

__Task__: Let *Y _{t }*:= log

*S*, use It¯o theory to derive the SDE which describes the

_{t}*Y*dynamics.

_{t }The filtering techniques require us to have no correlation between the system and the measurement noises. Therefore, by introducing the relation

*dW*_{2}(*t*)
= *ρdW*_{1}(*t*) + ^{p}1 − *ρ*^{2}*dW*_{3}(*t*)*, *(3)

we introduce a new Wiener process *W*_{3}(*t*)
which is uncorrelated with *W*_{1}(*t*). If we substitute
this relation in the equation (2), then express *dW*_{1}(*t*)
from the derived *Y _{t }*process dynamics and plug it into latest
version of the equation (2), we obtain an SDE for

*V*which depends on the new Wiener process:

_{t }__Task__: Discretize the latest equations for *V _{t }*and

*Y*using the Euler-Maruyama method.

_{t }### 2 Filtering Setup

In order to perform predictions we need to define the
system and measurements equations. For this, we will use the discretized
results from the previous section. We will let our state variable be *x *:= *V _{t }*and the measurement variable

*z*:=

*Y*. Then the discreet system will look as the following:

_{t}*x _{k }*=

*F*

_{k}x_{k}_{−1 }+

*A*+

_{k }*q*∼ N(0

_{k}, q_{k }*,Q*)

_{k}*,*(5)

*z*=

_{k }*H*+

_{k}x_{k }*B*+

_{k }*r*∼ N(0

_{k}, r_{k }*,R*)

_{k}*,*(6)

where

(7)

*A _{k }*=

*κθ*∆

*t*−

*λρµ*∆

*t*+

*λρ*(

*z*

_{k}_{−1 }−

*z*

_{k}_{−2})

*,*(8)

*Q _{k }*=

*λ*

^{2}(1 −

*ρ*

^{2})

*x*

_{k}_{−1}∆

*t,*(9)

(10)

*B _{k }*=

*z*

_{k}_{−1 }+

*µ*∆

*t,*(11)

*R _{k }*=

*x*

_{k}_{−1}∆

*t.*(12)

### 3 Data

In this assignment we use nonlinear Kalman filters with a calibrated Heston model to predict the prices of S&P 500 index. You may find the data in

SP500.mat file.

Figure 1: S&P 500 index historical prices.

The calibrated model has the following parameters: *µ *= 0*.*2016, *κ *= 2*.*1924, *θ *= 0*.*0133, *λ *=
0*.*2940, *ρ *= −0*.*6143. You may use *x*_{0 }= 0*.*0233
and

*P*_{0 }= 0*.*00001 as the
initial state and covariance, respectively.

__Basic Task__: Implement the extended Kalman
filter (EKF) for the model defined above. Comment if this model is suitable for
the data.

__Advanced Task__: Implement the unscented Kalman
filter (UKF) for the model defined above and comment on the results comparing
them with the results obtained using EKF. For the unscented transformation
parameters use *α _{K }*=

0*.*001, *β _{K }*= 2,

*κ*= 0, and

_{K }*λ*=

_{K }*α*

_{K}^{2 }(

*L*+

*κ*) −

_{K}*L*.

Document your work such that your results can be reproduced.

### 4 Report

You should hand in a report per group, no later than 17:00, May 18 (2015) in the Student Portal. Your report shall include algorithms, codes and results.