Model gbm
GBM model class.
GBM
Bases: SDE
Geometric Brownian Motion.
__init__(param=None)
Initialize the class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
param
|
parameter instance
|
True parameters used for simulation of the data |
None
|
betamat(theta)
Coefficients in linear representation of the first moment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
theta
|
array
|
Parameters |
required |
Returns:
| Type | Description |
|---|---|
float
|
Constant coefficient |
dbetamat(theta)
Calculate derivative of the first moment coefficients (numerical).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
theta
|
array
|
Parameters |
required |
Returns:
| Type | Description |
|---|---|
array
|
Derivatives of the coefficient |
dbetamat_exact(theta)
Calculate derivative of the first moment coefficients (exact).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
theta
|
array
|
Parameters |
required |
Returns:
| Type | Description |
|---|---|
array
|
Derivatives of the coefficient |
dgammamat(theta)
Calculate derivative of the second moment coefficients (numerical).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
theta
|
array
|
Parameters |
required |
Returns:
| Type | Description |
|---|---|
array
|
Derivatives of the coefficient |
dgammamat_exact(theta)
Calculate derivative of the second moment coefficients (exact).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
theta
|
array
|
Parameters |
required |
Returns:
| Type | Description |
|---|---|
array
|
Derivatives of the coefficient |
diff(*, state, theta)
staticmethod
Diffusion (instantaneous volatility) function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
(nvars, nsim) array_like
|
Current value of the process |
required |
theta
|
parameter instance
|
Model parameter |
required |
Returns:
| Type | Description |
|---|---|
scalar
|
Diffusion value |
drealized_const(theta)
Calculate derivative of the intercept in the realized moment conditions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
theta
|
array
|
Parameters |
required |
Returns:
| Type | Description |
|---|---|
(nparams, nintercepts) array
|
Derivatives of the coefficient |
drift(*, state, theta)
staticmethod
Drift function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
(nvars, nsim) array_like
|
Current value of the process |
required |
theta
|
parameter instance
|
Model parameter |
required |
Returns:
| Type | Description |
|---|---|
scalar
|
Drift value |
gammamat(theta)
Coefficients in linear representation of the second moment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
theta
|
array
|
Parameters |
required |
Returns:
| Type | Description |
|---|---|
float
|
Constant coefficient |
get_start()
Return starting values for simulation.
instruments(*, data, instrlag=1)
staticmethod
Create an array of instruments.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
(2, nobs) array
|
Returns and realized variance |
required |
instrlag
|
int
|
Number of lags for the instruments |
1
|
Returns:
| Type | Description |
|---|---|
(ninstr, nobs - instrlag) array
|
Derivatives of the coefficient |
integrated_mom(theta, *, data=None, instr_data=None, instr_choice='const', aggh=1, subset=Subset.all, instrlag=1, measure=Measure.P)
Integrated moment function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
theta
|
array
|
Model parameters |
required |
data
|
(2, nobs) array
|
Returns and realized variance |
None
|
instr_data
|
array_like
|
Instrument data |
None
|
instr_choice
|
str
|
Instrument choice |
'const'
|
aggh
|
int
|
Aggregation horizon |
1
|
subset
|
Subset
|
Subset |
all
|
instrlag
|
int
|
Number of lags for the instruments |
1
|
measure
|
Measure
|
Measure |
P
|
Returns:
| Name | Type | Description |
|---|---|---|
moments |
(nobs, nmoms) array
|
Moment restrictions |
dmoments |
(nmoms, nparams) array
|
Average derivative of the moment restrictions |
momcond(*, theta, data=None, instrlag=1)
Moment function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
theta
|
array
|
Model parameters |
required |
data
|
array
|
Whatever data is necessary to compute moment function |
None
|
instrlag
|
int
|
Number of lags for the instruments |
1
|
Returns:
| Name | Type | Description |
|---|---|---|
moments |
(nobs, nmoms) array
|
Moment restrictions |
dmoments |
(nmoms, nparams) array
|
Average derivative of the moment restrictions |
realized_const(*, param=None, aggh=1, subset=None)
Intercept in the realized moment conditions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
param
|
array
|
Parameters |
None
|
aggh
|
int
|
Interval length |
1
|
subset
|
slice
|
Which moments to use |
None
|
Returns:
| Type | Description |
|---|---|
array
|
Intercept |
realized_depvar(*, data, subset=None)
staticmethod
Array of the left-hand side variables in realized moment conditions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
(2, nobs) array
|
Returns and realized variance |
required |
subset
|
slice
|
Which moments to use |
None
|
Returns:
| Type | Description |
|---|---|
(3, nobs) array
|
Dependend variables |