.. _multiple_obs_fields:

Multiple Observed Fields
---------------------------

An example of multiple observed fields, is shown in :numref:`table_multiple_obs`.
 
.. _table_multiple_obs:

.. list-table:: |popy| multiple observed fields
    :header-rows: 1

    * - |type|
      - DRUG1
      - DRUG1_FLAG
      - DRUG2
      - DRUG2_FLAG
      - comment
      
    * - obs
      - 10.5
      - 1
      - 0.2
      - 1
      - Both drugs valid
      
    * - obs
      - 10.5
      - 1
      - 0.0
      - 0
      - only drug1 valid
      
    * - obs
      - -4.1
      - 0
      - 0.0
      - 0
      - both drugs invalid
      
    * - obs
      - -4.1
      - 0
      - 0.5
      - 1
      - only drug2 valid

In this case the |predictions| section may look something like:-

.. code-block:: pyml

    PREDICTIONS: |
        p[DRUG1] = s[CEN1]/m[V1]
        c[DRUG1] ~ norm(p[DRUG1], m[ANOISE_var1])
        p[DRUG2] = s[CEN2]/m[V2]
        c[DRUG2] ~ norm(p[DRUG2], m[ANOISE_var2])
        
Here |popy| uses the 'DRUG1_FLAG' and 'DRUG2_FLAG' fields from the data set to only compute the likelihood from valid observations. You don't have to use 'if' statements in the |predictions| section to achieve this.

