05-13-2010 07:47 PM
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)
05-14-2010 10:34 AM
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,
05-14-2010 12:05 PM
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
10-06-2013 11:30 PM
Hello Nimble,
have you implemented total least square method? if yes can you share the code?
regards
ravi
10-07-2013 12:44 PM
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.
10-07-2013 03:28 PM
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
08-14-2014 07:11 AM
Hello,
I have the same problem. FuManWho, did you succeed in making some code?
Best regards