# FitzHugh-Nagumo model

A model developed to mimic the evolution of a neuron's membrane potential. Originally, it has been developed as a modification to the Van der Pol oscillator.

Three parametrisations of the process are provided in this package.

### Regular

Defined simply as `FitzHughNagumo`

is a solution `(Y,X)`

to the following stochastic differential equation:

It can be called with

`@load_diffusion :FitzHughNagumo`

#### Example

```
using DiffusionDefinition
using StaticArrays, Plots
@load_diffusion FitzHughNagumo
θ = [0.1, -0.8, 1.5, 0.0, 0.3]
P = FitzHughNagumo(θ...)
tt, y1 = 0.0:0.001:30.0, @SVector [-0.9, -1.0]
X = rand(P, tt, y1)
plot(X, Val(:vs_time), size=(800, 300))
```

`plot(X, Val(:x_vs_y))`

### Alternative

The stochastic differential equation above is re-parametrized in such a way that the first coordinate is given by the integrated second coordinate:

The process (with name `FitzHughNagumoAlt`

) can be called with

`@load_diffusion :FitzHughNagumoAlt`

#### Example

A parameterization equivalent to the above is then given by:

```
using DiffusionDefinition
using StaticArrays, Plots
@load_diffusion FitzHughNagumoAlt
θ = [0.1, -0.8, 1.5, 0.0, 0.3]
P = FitzHughNagumoAlt(θ...)
tt, y1 = 0.0:0.001:30.0, @SVector [-0.9, 0.0]
X = rand(P, tt, y1)
plot(X, Val(:vs_time), size=(800, 300))
```

`plot(X, Val(:x_vs_y))`

### Conjugate

It is defined analogously to *alternative* parametrisation above, the only difference being that an additional step is taken of redefining the parameters:

This results in the stochastic differential equation of the form:

The diffusion (with a struct name `FitzHughNagumoConjug`

) can be called with

`@load_diffusion :FitzHughNagumoConjug`

#### Example

A parameterization equivalent to the above is then given by:

```
using DiffusionDefinition
using StaticArrays, Plots
@load_diffusion FitzHughNagumoConjug
θ = [10.0, -8.0, 15.0, 0.0, 3.0]
P = FitzHughNagumoConjug(θ...)
tt, y1 = 0.0:0.001:30.0, @SVector [-0.7, 0.0]
X = rand(P, tt, y1)
plot(X, Val(:vs_time), size=(800, 300))
```

`plot(X, Val(:x_vs_y))`

## Auxiliary diffusions (TODO the code won't execute correctly)

Additionally, we defined linear diffusions that can be taken as auxiliary processes in the setting of **Guided proposals**. For all of these definitions it is assumed that the target process is observed completely at discrete times. For other observation settings the auxiliary diffusions need to be defined by the user, but the definitions in this package may act as a guide on how to do it.

### For regular parametrisation

A linear diffusion obtained by linearising regular definition of the FitzHugh-Nagumo diffusion at an end-point:

It can be called with

`@load_diffusion :FitzHughNagumoAux`

### For alternative parametrisation

#### Simple

A pair: `(I,B)`

, where `B`

is a scaled Brownian motion and `I`

is an integrated `B`

:

Can be called with

`@load_diffusion :FitzHughNagumoAltAuxSimple`

#### Linearisation at the end-point

A linear diffusion obtained by linearising alternative definition of the FitzHugh-Nagumo diffusion at an end-point. If only the first coordinate is observed the proposal takes a form:

On the other hand, if both coordinates are observed, the proposal is given by:

Can be called with

`@load_diffusion :FitzHughNagumoAltAuxLin`

### For conjugate parametrisation

#### Simple

A pair: `(I,B)`

, where `B`

is a scaled Brownian motion and `I`

is an integrated `B`

:

Can be called with

`@load_diffusion :FitzHughNagumoConjugAuxSimple`

#### Linearisation at the end-point

It is defined analogously to `FitzHughNagumoAltAuxLin`

, the only difference being that an additional step is taken of redefining the parameters (just as it was done in `FitzHughNagumoConjug`

above). Consequently it is the solution to:

and can be called with

`@load_diffusion :FitzHughNagumoConjugAuxLin`