LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

orthogonal / Model II / total least squares / Deming regression

Has anyone coded up an orthogonal fit regression?
This is a Model II regression (error in both Y and X variables).

It may be known as Deming regression, total least squares regression, or to early published work by York [1].

It is used to perform a linear fit when you have error in both X and Y.

Thanks.

 

[1]

LEAST-SQUARES FITTING OF A STRAIGHT LINE

Derek York
Can. J. Phys./Rev. can. phys. 44(5): 1079-1086 (1966) 

LabVIEW user since 2.0
0 Kudos
Message 1 of 7
(4,781 Views)

Hello NimbleThink,

 

There is not a native VI in LabVIEW for Deming Regression. If you have MathScript Module, you can use the EIG function to find out the eigenvector for your array.



Xm = mean(X); A = cov(X);
[v,d] = eig(A);
[ignore,imax] = max(diag(d)); % Find eigenvector with max. eigenvalue

Then the line of regression is the line running through the mean point,
Xm, with direction dictated by the eigenvector with maximum
eigenvalue.


x = Xm + v(:,imax)'*t,

Andy Chang
National Instruments
0 Kudos
Message 2 of 7
(4,749 Views)

You appear to be assuming that I have data of the form array of X spaced by time interval t, since there no reference to a Y array.

 

What I need are the values for m and b (and their confidence intervals and the MSE) for the following:

 

 

Y = m * X + b

 

where there are errors in X and in Y.

Of course I would prefer to have an implementation which can also handle weights w[X] and w[Y], arrays of the same length as X and Y, however just one which allows for specification of the ratio of the variances of X and Y would do.

 

I will not use Mathscript or MATLAB modules as I prefer to have all the code in LabVIEW.

 

c.f. http://en.wikipedia.org/wiki/Deming_regression

 

LabVIEW user since 2.0
0 Kudos
Message 3 of 7
(4,737 Views)

Hello Nimble,

have you implemented total least square method? if yes can you share the code?

regards

ravi

0 Kudos
Message 4 of 7
(3,938 Views)

Hey eravikrishnan,

 

The last post in this thread was 3 years ago, so you may not receive a reply from the original poster. If you have any questions in particular, I recommend creating a new thread so that other users can help you answer your question.

Paolo F.
National Instruments
Applications Engineer
0 Kudos
Message 5 of 7
(3,912 Views)

Yes, I implemented a total least squares fitting method in LV a few years ago.

No, I cannot share the code because I no longer work at that employer and no longer have access to LV.

 

Sorry for the bad news.

 

It's not that hard to implement: find some statistics sites that give an algorithm for implementing total least squares (I may have worked off a Wiki example in C-code).

Create subroutine VIs for some of the functions, then tie them together to get the result.

 

Be careful with memory allocation for vectors, otherwise large datasets will slow your code down a lot.

 

Best regards,

 

Leif Kirschenbaum

NimbleThink

LabVIEW user since 2.0
0 Kudos
Message 6 of 7
(3,904 Views)

Hello,

 

I have the same problem. FuManWho, did you succeed in making some code?

 

 

Best regards

0 Kudos
Message 7 of 7
(3,738 Views)