# COVARIANCE

An optional section that requests PoPy to compute Standard Errors of the `f[X]` variables, after running a Fit Script.

The COVARIANCE option is only available in a Fit Script or Tut Script. The Tut Script simply passes the COVARIANCE section to the Fit Script. The MFit Script and MTut Script do not currently include this option.

## COVARIANCE Example

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

    COVARIANCE: {NO_COVARIANCE: {}}

In the Fit Script and no standard errors are computed.

If you use this setting:-

    COVARIANCE: {SANDWICH: {}}

After the Fit Script outputs the final `f[X]` estimates, PoPy will compute the standard errors using a similar method to that employed by Nonmem when using the ‘$COVARIANCE’ flag, utilising a sandwich operator. See Standard Errors for more details.

By default PoPy computes standard errors using only the main `f[X]` estimates and excludes the variance `f[X]`.

You can include the variance `f[X]` using the following setting:-

    COVARIANCE: {SANDWICH: {var_covariance_flag: True}}

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