emod_analysis
binom_vec(yobs, ysim)
Source code in local_python/py_assets_common/emod_analysis.py
gauss_opt(yobs, ysim)
Source code in local_python/py_assets_common/emod_analysis.py
gauss_vec(dmu2, sig2, yscal=1.0)
Source code in local_python/py_assets_common/emod_analysis.py
multinom_vec(yobs, ysim)
Source code in local_python/py_assets_common/emod_analysis.py
norpois_opt(yobs, ysim)
Preferred entry point for norpois_vec function, which calculates a
Poisson-based estimation of log-liklihood for a timeseries. This function
determines coefficients in the scale factor by maximizing log-liklihood.
Maximum liklihood scale factor coefficients may result in unreasonable values (i.e., reporting rates greater than 100%). Unreasonable scaling coefficients occur when simulation outcomes are a very poor match to observed values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
yobs
|
list[float]
|
List of observed timeseries values. |
required |
ysim
|
list[float]
|
List of simulated timeseries values. May be longer than the list of observed values. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Ltot |
float
|
Calculated log-liklihood estimator. |
pvec |
[float, float]
|
The [mval, bval] parameters that maximize the log-liklihood. |
Source code in local_python/py_assets_common/emod_analysis.py
norpois_vec(yobs, ysim, mval=0.0, bval=0.0)
Poisson-based estimation of log-liklihood for a timeseries. The vector of observed values is used as the occurances (k) and the vector of simulated values is used as the rates (lam). Stirling's approximation is applied to the factorial term: ln P = kln(lam/k) - lam + k - 0.5ln(2pik)
A small positive value is added to the simulated rates so they are never
exactly zero. The adjusted rates are then modified by a scale factor
that represents the case to infection ratio. Scale factor adjustements
have an exp(m*x + b) form that allows for changes over time. The values
in the timeseries are assumed to be equally spaced, so the x value in
the scale factor is the index of the value in the vector.
lam = (ysim + delt)exp(mvalx + bval)
k = yobs
First and second derivatives of probability with respect to mval and
bval coefficients in the scale factor are also calculated.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
yobs
|
list[float]
|
List of observed timeseries values. |
required |
ysim
|
list[float]
|
List of simulated timeseries values. May be longer than the list of observed values. |
required |
mval
|
float
|
Linear parameter in scale factor calculations. |
0.0
|
bval
|
float
|
Constant parameter in scale factor calculations. |
0.0
|
Returns:
| Name | Type | Description |
|---|---|---|
Ltot |
float
|
Calculated log-liklihood estimator. |
dval |
[float, float]
|
Estimated Newton-step to adjust [mval, bval] parameters when maximizing log-liklihood. |