07-24-2013 04:44 PM
I am using Labview 8.5, which has the weighted linear fit vi.
What values are acceptable as weights? In other fitting software the weights expected are usually standard deviations of each value. It seems to me that the weights expected by the weighted linear fit vi are in a range from 0 to 1, corresponding to how much you value that point.
What is the vi actually looking for? Some value between 0 and 1 or the standard deviation for each particular value of the dependent variable?
I can't tell just by reading the help or looking online.
Solved! Go to Solution.
07-24-2013 04:56 PM
You can use any weight you want, from zero to near infinity.
If you know the variance for your data, set the weight as the inverse of the variance (See also).
weight = 1/variance or
weight = 1/(standard deviation)²
07-24-2013 05:04 PM
Thanks for the quick reply, altenbach!
Ok, so it is the inverse of the variance. Other software will ask for standard deviation as the weight. Others will ask for 1/standard deviation. Labview is the only one that I've seen that is asking for 1/variance.
Since the help file doesn't address this, can I assume that this is very standard practice and anyone familiar with the term "weight" when it comes to fitting a function will automatically assume it means 1/variance?
07-24-2013 05:32 PM - edited 07-24-2013 05:53 PM
Prior to LabVIEW 8.0, there was a "standard deviation" input instead of a weight input for the nonlinear fit function, but internally the code was basically the same (It was immediately converted to a weight internally).
Weight is better and more convenient because you can completely disregard portions of the data by setting the weight to zero, while it would be weird trying to set the standard deviation to infinity to get the same effect (well, it would not work unless the function can detect that special case and adapt to it). 😉
Since it is mathematically very simple to translate an standard deviation into a weight, you can do that easily yourself.
07-24-2013 05:36 PM
Cool. Thank you.
At least now I know what the vi is looking for.
07-24-2013 05:52 PM
Quote from wikipedia on Linear Least Squares (mathematics):
"The weights should, ideally, be equal to the reciprocal of the variance of the measurement"