TLS regression in statsmodels

54 views
Skip to first unread message

Oliver Angelil

unread,
Aug 18, 2017, 7:34:41 AM8/18/17
to pystatsmodels
I've been using the function provided in this blog post to perform Total Least Squares regression (also known as Orthogonal Least Squares).

I'm now at a stage where I want confidence intervals and p-values. Could statsmodels do this?

Oliver

josef...@gmail.com

unread,
Aug 18, 2017, 9:06:24 AM8/18/17
to pystatsmodels
No, statsmodels doesn't have anything for orthogonal distance regression. You need to check what the scipy class provides. I never looked at scipy's ODR except for some simple examples a long time ago and cannot provide additional hints.

On a related topic: 
I looked for some time last year at estimation with known measurement error (co)variance of the explanatory variables and have some draft code for that. The main difference, besides that I looked only at linear regression, is that in contrast to ODR all unexplained remaining or residual variance is allocated to the dependent variable after taking the known measurement errors into account.
(Some authors criticized ODR because it doesn't allow for unknown approximation, equation or similar residual error.)

Josef
 

josef...@gmail.com

unread,
Aug 18, 2017, 11:37:46 AM8/18/17
to pystatsmodels
On Fri, Aug 18, 2017 at 9:06 AM, <josef...@gmail.com> wrote:


On Fri, Aug 18, 2017 at 1:16 AM, Oliver Angelil <molo...@gmail.com> wrote:
I've been using the function provided in this blog post to perform Total Least Squares regression (also known as Orthogonal Least Squares).

I'm now at a stage where I want confidence intervals and p-values. Could statsmodels do this?

Oliver

No, statsmodels doesn't have anything for orthogonal distance regression. You need to check what the scipy class provides. I never looked at scipy's ODR except for some simple examples a long time ago and cannot provide additional hints.

based on a quick search for the documentation
provides sd_beta and cov_beta, so confidence intervals and p-values can be computed similarly to what we do in statsmodels.

I never tried, but from the documentation of odr.Output it should be possible to wrap it into one of our results classes which would then provide the inherited methods for tvalues, pvalues, confint and and t/wald tests. Other things like loglike, rsquared might not make sense for ODR.

Josef

Oliver Angelil

unread,
Aug 18, 2017, 11:48:51 PM8/18/17
to pystatsmodels
If ODR is not available in statsmodels, maybe that's a sign it's not needed by many people anyways. ;) 

I wouldn't know how to calculate p-values and conf intervals from the scipy.odr. I guess I'll have to use R for this. 

Thanks,
Ollie
Reply all
Reply to author
Forward
0 new messages