.. _covariance:

COVARIANCE
#################

An optional section that requests |popy| to compute :ref:`standard_errors` of the |fx| variables, after running a :ref:`fit_script`.

The |covariance| option is only available in a :ref:`fit_script` or :ref:`tut_script`. The :ref:`tut_script` simply passes the |covariance| section to the :ref:`fit_script`. The :ref:`mfit_script` and :ref:`mtut_script` do not currently include this option.

.. _covariance_example:

COVARIANCE Example
=======================

If you miss out the 'COVARIANCE' field, that is equivalent to putting:-

.. code-block:: pyml

    COVARIANCE: {NO_COVARIANCE: {}}
    
In the :ref:`fit_script` and no standard errors are computed. 

If you use this setting:-

.. code-block:: pyml

    COVARIANCE: {SANDWICH: {}}
    
After the :ref:`fit_script` outputs the final |fx| estimates, |popy| will compute the standard errors utilising a sandwich operator. See :ref:`standard_errors` for more details.

By default |popy| computes standard errors using only the main |fx| estimates and excludes the variance |fx|.

You can include the variance |fx| using the following setting:-

.. code-block:: pyml

    COVARIANCE: {SANDWICH: {var_covariance_flag: True}}

This will compute standard error estimates for all |fx| however it will take a long time if you have large variance |fx| matrices in your model. Also note that the standard error estimates will be different if the variances are included in the computation.
