# [SciPy-User] [SciPy-user] scipy.odr - Correct form of covx, covy matrix

Elfnor elfnor@gmail....
Mon Feb 13 20:38:03 CST 2012

```

Robert Kern-2 wrote:
>
>
> covx and covy aren't covariance matrices across observations, i.e. not
> the 10x10 matrices that you have here. Rather, what you need to
> provide is a length-10 array of covariance matrices, one for each
> observation. For the case where each of your observations are
> 1-dimensional, you don't construct covariance matrices at all, just
> provide the standard deviations:
>
>   p_dat = RealData(p_x, p_y, sx=p_sx, sy=p_sy)
>
> https://github.com/scipy/scipy/blob/master/scipy/odr/odrpack.py#L27
>
> --
>

OK. I gave an example with diagonal covariance matrices to make the problem
easy to explain.
covy in ODR I see would be 10 2 by 2 matrices for the pearson's example,
each giving the covaraiance between the parameters at that observation.

I am trying to solve a generalised least squares problem of the form A*x = b
where A is the problem design matrix and b is a vector of correlated
observations with covariance V. V is not diagonal.

That is find x that minimizes (b - A*x)'*inv(V)*(b - A*x) similar to the
matlab function lscov.

I'm now looking at the GLS fit from scikits.statsmodels.

Thanks Eleanor
--
View this message in context: http://old.nabble.com/scipy.odr---Correct-form-of-covx%2C-covy-matrix-tp33312093p33319485.html
Sent from the Scipy-User mailing list archive at Nabble.com.

```