.. _identifiability:

Identifiability
################

When designing a model, we must take care to ensure that there is a unique set of parameters that is better (|ie| has a higher likelihood or lower cost) than all other nearby solutions. If this is the case, the model parameters are said to be *identifiable*.

If two different sets of parameters can produce an identical fit to the data, and hence an identical likelihood, the model is unidentifiable.  (Give a daft example)

Flip-flop is actually something completely different here from the usual meaning of "flip flop" and doesn't technically agree with what we have written. Specifically, we identify two distinct parameter sets that give the same answer when, in fact, there is an infinite continuum of solutions that give the same answer. Flip-flop kinetics, in contrast, is where the two curves look *similar* (but not identical) but where the limiting factor in the drug's reduction is KA or KE, depending on which flip-flop state you are considering.

Generally, avoid this flip-flop example until we've sorted out the confusion.

.. _flip_flop:

Flip Flop
==========

.. comment
    Sort out the math equations. Specifically, don’t use inline maths; just use italics instead.
    Note about the randseed option - it only generates the same data if the model otherwise is unchanged. Be careful with models that introduce new (even when redundant) parameters.
    This would be a very good place to show a surface plot in (Ka,Ke) space.
    Why do the two fits have such different OBJV values? If they are essentially equivalent, they should generate similar predictions and similar errors. The difference must be in the priors for V - its two fitted values are significantly different depending on which of the two states are used, such that one is penalized far more heavily than the other. (The one that’s furthest from the true values requires much more extreme values of r[V] to get similar model parameters.)
    But then are they really indistinguishable if one has a significantly lower OBJV than the other?

.. include:: identifiability/flip_flop_intro.txt


Identifiability in a one compartment model
-------------------------------------------
.. include:: identifiability/flip_flop_one_cmp.txt


.. _flip_flop_good:

Flip Flop Good Fit
-------------------------------------------
.. include:: identifiability/flip_flop_good_fit.txt

.. comment
    This figure doesn't exist

    .. figure:: /case-studies/indiv_examples/uncertainty/flip_flop_good_tut.pyml_output/flip_flop_good_stderr_fit.pyml_output/objv_contour.*
        :align: center
        :width: 75%
        :name: fig_flip_flop_surface

        Surface plot of the Objective Function Value (OBJV) for a flip-flop kinetics example


.. _flip_flop_bad:

Flip Flop Bad Fit
-------------------------------------------
.. include:: identifiability/flip_flop_bad_fit.txt


Conclusion
-------------------------------------------
.. include:: identifiability/flip_flop_conclusion.txt

    
.. _nondeterminable_case_study:

Overparameterization
=======================
.. include:: identifiability/nondeterminable.txt


.. _bioavailability_and_lag:

Bioavailability and Lag
=============================================
As an example, we consider a one compartment model with first order absorption (see :ref:`dep_one_cmp_cl`) that has two additional parameters: bioavailability and a lag.

    
Bioavailability
------------------------------------
.. include:: identifiability/bioavailability_intro.txt


Lag Time
------------------------------------
.. include:: identifiability/lag_time_intro.txt


This example - a one compartment model with IV administration - makes no sense. BIO would be 1.0 (by definition) and LAG would be 0.0 (by definition).

Bioavailability and Lag Time
------------------------------------
.. include:: identifiability/bio_lag_time.txt    


Confounded Bioavailability and Lag Time
-------------------------------------------
.. include:: identifiability/bio_lag_confusion.txt


|popy| Example of a Confounded Model
-------------------------------------------
.. include:: identifiability/bio_lag_one_cmp.txt


This plot, though very illustrative, represents the relationship between BIO and LAG for a one compartment model with IV administration. 
However, with this model BIO=1 and LAG=0 *by definition*. Therefore these parameters would never actually vary for this structure.

.. comment
    This figure doesn't exist

    .. figure:: /case-studies/indiv_examples/uncertainty/biolag_both_tut.pyml_output/biolag_both_stderr_fit.pyml_output/objv_contour.*
        :align: center
        :width: 75%
        :name: fig_biolag_surface
        
        Surface plot of the Objective Function Value (OBJV) for bioavailability/lag example using free parameters BIO and LAG
            

Confounding between BIO and LAG
-------------------------------------------
.. include:: identifiability/bio_lag_two_cmp.txt


Weibull Dosing Parameters
===========================

New tutorial that shows that Weibull shape parameters can easily be confounded with the LAG parameter.
Good demonstration of the Weibull dosing function (that NONMEM does not have).
