## Base SDE Models

### Overview

The base `sde` object

`$d{X}_{t}=F\left(t,{X}_{t}\right)dt+G\left(t,{X}_{t}\right)d{W}_{t}$`

represents the most general model.

Tip

The `sde` class is not an abstract class. You can instantiate `sde` objects directly to extend the set of core models.

Creating an `sde` object using `sde` requires the following inputs:

• A drift-rate function `F`. This function returns an `NVars`-by-`1` drift-rate vector when run with the following inputs:

• A real-valued scalar observation time t.

• An `NVars`-by-`1` state vector Xt.

• A diffusion-rate function `G`. This function returns an `NVars`-by-`NBrowns` diffusion-rate matrix when run with the inputs t and Xt.

Evaluating object parameters by passing (t, Xt) to a common, published interface allows most parameters to be referenced by a common input argument list that reinforces common method programming. You can use this simple function evaluation approach to model or construct powerful analytics, as in the following example.

### Specify Base Stochastic Differential Equation (SDE) Model

Create an `sde` object using `sde` to represent a univariate geometric Brownian Motion model of the form:

Create drift and diffusion functions that are accessible by the common ($\mathit{t},{\mathit{X}}_{\mathit{t}}^{}$) interface.

```F = @(t,X) 0.1 * X; G = @(t,X) 0.3 * X;```

Pass the drift and diffusion functions to `sde` to creare an `sde` object.

`obj = sde(F, G) % dX = F(t,X)dt + G(t,X)dW`
```obj = Class SDE: Stochastic Differential Equation ------------------------------------------- Dimensions: State = 1, Brownian = 1 ------------------------------------------- StartTime: 0 StartState: 1 Correlation: 1 Drift: drift rate function F(t,X(t)) Diffusion: diffusion rate function G(t,X(t)) Simulation: simulation method/function simByEuler ```

The `sde` object displays like a MATLAB® structure, with the following information:

• The object's class

• A brief description of the object

• A brief description of the object

The object's displayed parameters are as follows:

• `StartTime`:` `The initial observation time (real-valued scalar).

• `StartState`: The initial state vector (`NVars`-by-`1` column vector).

• `Correlation`: The correlation structure between Brownian process.

• `Drift`: The drift-rate function $\mathit{F}\left(\mathit{t},{\mathit{X}}_{\mathit{t}}^{}\right)$.

• `Diffusion`: The diffusion-rate function $\mathit{G}\left(\mathit{t},{\mathit{X}}_{\mathit{t}}^{}\right)$.

• `Simulation`: The simulation method or function.

Of these displayed parameters, only `Drift` and `Diffusion` are required inputs.

The only exception to the ($\mathit{t},{\mathit{X}}_{\mathit{t}}^{}$) evaluation interface is `Correlation`. Specifically, when you enter `Correlation` as a function, the SDE engine assumes that it is a deterministic function of time, $\mathit{C}\left(\mathit{t}\right)$. This restriction on `Correlation` as a deterministic function of time allows Cholesky factors to be computed and stored before the formal simulation. This inconsistency dramatically improves run-time performance for dynamic correlation structures. If `Correlation` is stochastic, you can also include it within the simulation architecture as part of a more general random number generation function.