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

josef.pktd at gmail.com josef.pktd at gmail.com
Tue Feb 14 11:12:40 EST 2012


On Tue, Feb 14, 2012 at 10:20 AM, Sturla Molden <sturla at molden.no> wrote:
> On 14.02.2012 15:55, josef.pktd at gmail.com wrote:
>
>>>   from scipy import linalg
>>>
>>>   cho = linalg.cho_factor(V)
>>>   Ac = linalg.cho_solve(cho, A)
>>>   bc = linalg.cho_solve(cho, b)
>>>   x = linalg.solve(Ac, bc)
>>
>> That's pretty much what statsmodels GLS does. The transformed
>> variables have a w prefix, wendog, wexog, wresid
>>
>> I don't think we have many examples with the full sized (nobs, nobs) V matrix.
>
> Why not call lapack DGGGLM? It does the same, except with QR.

I didn't know about it and it's not yet available
>
> It could e.g. be exposed as sp.linalg.glstsq.

volunteers?

One problem we have in statsmodels is that we still need additional
results not just the parameter estimates, for example inv(x'x) (or
pinv) or inv(X' inv(V) X) (IIRC) for the covariance matrix and the
determinant for the log likelihood.

I tried to work on the linear algebra a few times to avoid some
repeated and some numerically doubtful calculations, but it's too much
work (when I'd rather work on something else). Now we are just using
pinv or QR for the least squares solution and cholesky for the
transformation.

Josef

>
> Sturla
> _______________________________________________
> SciPy-User mailing list
> SciPy-User at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user



More information about the SciPy-User mailing list