# Covariance Matrix Estimation

If the optional argument calc_cov=True is specified for theta_est, parmest will calculate the covariance matrix $$V_{\theta}$$ as follows:

$V_{\theta} = 2 \sigma^2 H^{-1}$

This formula assumes all measurement errors are independent and identically distributed with variance $$\sigma^2$$. $$H^{-1}$$ is the inverse of the Hessian matrix for a unweighted sum of least squares problem. Currently, the covariance approximation is only valid if the objective given to parmest is the sum of squared error. Moreover, parmest approximates the variance of the measurement errors as $$\sigma^2 = \frac{1}{n-l} \sum e_i^2$$ where $$n$$ is the number of data points, $$l$$ is the number of fitted parameters, and $$e_i$$ is the residual for experiment $$i$$.