Package: identifiability
identifiability - Parameter identifiability analysis in PythonThis module performs parameter identifiability
analysis to calculate and plot confidence intervals based on a profile-likelihood.
The code is adapted fromLMFIT, with custom
functions to select the range for parameter scanning and for plotting the profile
likelihood. The significance is assessed with the chi-squared distribution.
Optimization runs can be performed in parallel (using themultiprocessingmodule).Installationidentifiabilityis a pure-Python module. The latest development version can be
installed with$pipinstallhttps://github.com/jmrohwer/identifiability/archive/refs/heads/main.zipThe latest stable release is available on PyPI:$pipinstallidentifiabilityThe module can be used in combination withPySCeSfor
simulation and parameter estimation of kinetic models using theCVODEsolver. When
performing identifiability analysis in parallel usingmultiprocessing, additional
dependences are required; these can be installed with:$pipinstall"identifiability[pyscesmp]"Basic usageFor background, the reader is referred to the section onCalculation of confidence
intervalsin theLMFIT documentation.To start the identifiability analysis, the user first needs to have performed a
parameter estimation with LMFIT. The method for estimating confidence intervals
takes an instantiated LMFITMinimizerobject and aMinimizerResultobject as input.A typical workflow would entail:>>>fromidentifiabilityimportconf_interval>>>c=conf_interval(mini,result,prob=0.95,limits=0.5,log=False,points=11,return_CIclass=True)>>>print(c[0])# OrderedDict of parameter names and corresponding confidence intervals>>>c[1].plot_ci('a')# plot confidence interval for parameter 'a'>>>c[1].plot_all_ci()# plot confidence intervals for all parametersWhen using theModelwrapper of LMFIT
to perform the parameter estimation and model fit, the instantiatedModelResultobject should be passed twice to theconf_interval()method, instead of theMinimizerandMinimizerResult(see above). In this case the function call would be:>>>c=conf_interval(modelresult,modelresult,prob=0.95,limits=0.5,log=False,points=11,return_CIclass=True)Once a profile likelihood has been calculated, the same data can be used to calculate
the confidence interval for a different probability, thus avoiding the
computationally intensive re-calculation of the profile likelihood:>>>c[1].calc_all_ci(prob=0.8)Docstring of theconf_intervalmethoddefconf_interval(minimizer,result,p_names=None,prob=0.95,limits=0.5,log=False,points=11,method='leastsq',return_CIclass=False,mp=True,):"""Calculate the confidence interval (CI) for parameters.The parameter for which the CI is calculated will be varied, while theremaining parameters are re-optimized to minimize the chi-square. Theresulting chi-square is used to calculate the probability with a givenstatistic, i.e. chi-squared test.Parameters----------minimizer : Minimizer or ModelResultThe minimizer to use, holding objective function.result : MinimizerResult or ModelResultThe result of running Minimizer.minimize() or Model.fit().p_names : list, optionalNames of the parameters for which the CI is calculated. If None(default), the CI is calculated for every parameter.prob : float, optionalThe probability for the confidence interval (<1). If None,the default is 0.95 (95 % confidence interval).limits : float, optionalThe limits (as a fraction of the original parameter value) within whichto vary the parameters for identifiability analysis (default is 0.5).If ``log=False``, the parameter is varied from p*limits to p*(2 - limits),where p is the original value.If ``log=True``, the parameter is varied from p*limits to p/limits.log : bool, optionalWhether to vary the parameter in a log (True) or a linear (False,default) scale.points : int, optionalThe number of points for which to calculate the profile likelihood overthe given parameter range.method : str, optionalThe lmfit mimimize() method to use (default='leastsq')return_CIclass : bool, optionalWhen true, return the instantiated ``ConfidenceInterval`` class toaccess its methods directly (default=False).mp : bool, optionalRun the optimization in parallel using ``multiprocessing`` (default=True)Returns-------output : dictA dictionary containing a list of ``(lower, upper)``-tuples containingthe confidence bounds for each parameter.ci : ``ConfidenceInterval`` instance, optionalInstantiated ``ConfidenceInterval`` class to access the attached methods."""© Johann M. Rohwer, 2023