fit.fisher¶
Fisher information of a parameter fit.
The profile likelihood of sbmlsim.fit.identifiability scans a parameter and
re-optimizes the others, which is exact and costs a simulation per point. The
Fisher information is the local alternative: the curvature of the cost at the
optimum, from which the standard errors, the correlations of the parameters and
the directions the data does not constrain follow, at the cost of one jacobian.
For a fit which minimizes cost = 0.5 * Σ r² with the weighted residuals r,
the Gauss-Newton approximation of the Hessian is J' J with the jacobian
J = ∂r/∂θ, which is the Fisher information matrix of the estimate. Its
inverse, scaled by the variance of the residuals, is the covariance of the
parameters:
FIM = J' J, cov = σ² (J' J)⁻¹, σ² = 2 cost / (n - k)
The two analyses answer different questions and disagree where the cost is not a quadratic: the Fisher information is a local statement about the optimum, the profile likelihood follows the cost until it rises by the threshold. A parameter which the Fisher information calls determined and the profile likelihood calls non-identifiable is a parameter whose cost is flat away from the optimum, which is what the profile is for.
FisherInformation
dataclass
¶
FisherInformation(
opid,
sid,
pids,
values,
scale,
matrix,
cost,
n,
alpha=0.95,
rank_tolerance=DEFAULT_RANK_TOLERANCE,
units=list(),
)
The Fisher information of a parameter set on a problem.
Attributes:
| Name | Type | Description |
|---|---|---|
opid |
str
|
id of the optimization problem. |
sid |
str
|
id of the parameter set. |
pids |
list[str]
|
parameters, in the order of the matrix. |
values |
ndarray
|
values of the parameters, in the units of the model. |
scale |
ParameterScaleType
|
space the matrix is expressed in, i.e. the space the optimizer
searches, see |
matrix |
ndarray
|
the Fisher information |
cost |
float
|
cost of the parameter set. |
n |
int
|
number of data points of the fit. |
alpha |
float
|
confidence level of the intervals. |
sigma2
property
¶
Get the variance of the residuals, 2 cost / (n - k).
A fit with as many parameters as data points has no degrees of freedom
left and no variance to estimate, which is nan.
eigenvalues
property
¶
Get the eigenvalues of the Fisher information, largest first.
The matrix is symmetric and positive semi-definite, so the eigenvalues are real and not negative up to rounding. A small eigenvalue is a direction in parameter space the data does not constrain.
condition_number
property
¶
Get the ratio of the largest to the smallest eigenvalue.
A large condition number is a problem which is sloppy: the data determines some combinations of the parameters much better than others.
is_identifiable
property
¶
Check whether the data constrains every direction locally.
covariance
property
¶
Get the covariance of the parameters in the scaled space.
cov = σ² (J' J)⁻¹, with the pseudo-inverse for a matrix which is rank
deficient, i.e. for a problem which is locally not identifiable. The
covariance of such a problem is not a covariance, its entries of the
unconstrained directions are arbitrary; is_identifiable says whether
it can be read. The warning about it is logged once per information.
standard_errors
property
¶
Get the standard error of every parameter in the scaled space.
correlation
property
¶
Get the correlation of the parameters.
Two parameters which are correlated to ±1 are the pair the data only
determines together, i.e. the fit can trade one against the other.
confidence_intervals
¶
Get the confidence interval of every parameter.
The interval is θ ± t · SE in the space the optimizer searches, with
the quantile of the t distribution of n - k degrees of freedom, and
is transformed back into the units of the model. On a logarithmic scale
the interval is therefore not symmetric around the value.
Returns:
| Type | Description |
|---|---|
tuple[ndarray, ndarray]
|
The lower and the upper bound in the units of the model. |
jacobian
¶
Get the jacobian of the weighted residuals by central differences.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
problem
|
OptimizationProblem
|
initialized optimization problem. |
required |
x
|
ndarray
|
parameters in the space the optimizer searches. |
required |
step
|
float
|
relative step of the differences. |
DEFAULT_STEP
|
Returns:
| Type | Description |
|---|---|
ndarray
|
The jacobian with one row per residual and one column per parameter. |
fisher_information
¶
fisher_information(
problem,
settings,
parameter_set,
alpha=0.95,
step=DEFAULT_STEP,
rank_tolerance=DEFAULT_RANK_TOLERANCE,
)
Calculate the Fisher information of a parameter set on a problem.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
problem
|
OptimizationProblem
|
optimization problem, initialized with the settings. |
required |
settings
|
FitSettings
|
settings the parameters were fitted with. |
required |
parameter_set
|
ParameterSet
|
parameters to evaluate the information at, i.e. the result of a fit. |
required |
alpha
|
float
|
confidence level of the intervals. |
0.95
|
step
|
float
|
relative step of the finite differences of the jacobian. |
DEFAULT_STEP
|
rank_tolerance
|
float
|
eigenvalues below this fraction of the largest one are a direction the data does not constrain. |
DEFAULT_RANK_TOLERANCE
|
Returns:
| Type | Description |
|---|---|
FisherInformation
|
The Fisher information with the errors, the correlations and the |
FisherInformation
|
directions the data does not constrain. |