pfjax.experimental.models.lotvol_model
Lotka-Volterra predator-prey model.
The model is:
exp(x_m0) = exp( (logH_m0, logL_m0) ) ~ pi(x_m0) \propto 1
logH_mt ~ N(logH_{m,t-1} + (alpha - beta exp(logL_{m,t-1})) dt/m,
sigma_H^2 dt/m)
logL_mt ~ N(logL_{m,t-1} + (-gamma + delta exp(logH_{m,t-1})) dt/m,
sigma_L^2 dt/m)
y_t ~ N( exp(x_{m,mt}), diag(tau_H^2, tau_L^2) )
- Model parameters:
theta = (alpha, beta, gamma, delta, sigma_H, sigma_L, tau_H, tau_L). - Global constants:
dtandn_res, i.e.,m. - State dimensions:
n_state = (n_res, 2). - Measurement dimensions:
n_meas = 2.
Notes:
-
The measurement
y_tcorresponds tox_t = (x_{m,(t-1)m+1}, ..., x_{m,tm}), i.e., aligns with the last element ofx_t. -
The prior is such that
p(x_0 | y_0, theta)is given by:
Classes:
| Name | Description |
|---|---|
LotVolModel |
|
LotVolModel
Bases: SDEModel
Methods:
| Name | Description |
|---|---|
drift |
Calculates the SDE drift function. |
diff |
Calculates the SDE diffusion function. |
meas_lpdf |
Log-density of |
meas_sample |
Sample from |
pf_init |
Particle filter calculation for |
Source code in src/pfjax/experimental/models/lotvol_model.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | |
drift(x, theta)
Calculates the SDE drift function.
Source code in src/pfjax/experimental/models/lotvol_model.py
diff(x, theta)
meas_lpdf(y_curr, x_curr, theta)
Log-density of p(y_curr | x_curr, theta).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y_curr
|
Measurement variable at current time |
required | |
x_curr
|
State variable at current time |
required | |
theta
|
Parameter value. |
required |
Returns
The log-density of p(y_curr | x_curr, theta).
Source code in src/pfjax/experimental/models/lotvol_model.py
meas_sample(key, x_curr, theta)
Sample from p(y_curr | x_curr, theta).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
PRNG key. |
required | |
x_curr
|
State variable at current time |
required | |
theta
|
Parameter value. |
required |
Returns:
| Type | Description |
|---|---|
|
Sample of the measurement variable at current time |
Source code in src/pfjax/experimental/models/lotvol_model.py
pf_init(key, y_init, theta)
Particle filter calculation for x_init.
Samples from an importance sampling proposal distribution
and calculates the log weightFIXME: Explain what the proposal is and why it gives logw = 0.
In fact, if you think about it hard enough then it's not actually a perfect proposal...
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y_init
|
Measurement variable at initial time |
required | |
theta
|
Parameter value. |
required | |
key
|
PRNG key. |
required |
Returns:
| Type | Description |
|---|---|
|
|
|