Showing results for 
Search instead for 
Did you mean: 

Weight values in weighted linear fit

Go to solution

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. 

0 Kudos
Message 1 of 6
Accepted by topic author VariableRange

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)²


0 Kudos
Message 2 of 6

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? 

0 Kudos
Message 3 of 6

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.



0 Kudos
Message 4 of 6

Cool. Thank you. 


At least now I know what the vi is looking for. 



0 Kudos
Message 5 of 6

Quote from wikipedia on Linear Least Squares (mathematics):


"The weights should, ideally, be equal to the reciprocal of the variance of the measurement"


0 Kudos
Message 6 of 6