The weighted least squares formula - Quick question

In summary, the weighted least squares formula is a statistical method used to minimize the sum of squared errors in a regression model by assigning weights to each data point based on its relative importance. It is often used when there is heteroscedasticity, or unequal variance, in the data. The formula takes into account both the error and the weight of each data point, resulting in a more accurate and precise regression model.
  • #1
binbagsss
1,299
11
The weighted least squares formula - Quick question !

m=Ʃiwi Ʃiwixiyi - Ʃiwixi Ʃiwiyi

- In this formula, does wi mean to include the weighting of all points - i.e. both x and y points throughout.

Thanks Alot !
 
Physics news on Phys.org
  • #3


Thanks for the reply. ok so when its eg Ʃwixi - so this means the product of each x value and its weighting, summed up.

So how would you include the y weightings ?
 
  • #4


binbagsss said:
Thanks for the reply. ok so when its eg Ʃwixi - so this means the product of each x value and its weighting, summed up.

So how would you include the y weightings ?

I don't understand what it is that you don't understand. The formula you posted in the OP showed how include weightings on both x and y, and so (in a different format) does the link I posted. They're not separate weightings. Each weight is associated with a datapoint, both x and y.
 
  • #5


haruspex said:
I don't understand what it is that you don't understand. The formula you posted in the OP showed how include weightings on both x and y, and so (in a different format) does the link I posted. They're not separate weightings. Each weight is associated with a datapoint, both x and y.

Sorry. Perhaps my original question was not clear enough. I mean for the terms such as Ʃw(i)x(i) and Ʃw(i)y(i) is it just the corresponding weightings you include so for the first term , only weightings on the x data points, and the second term only weightings on the y data points.

But then for the first term Ʃwi - does this just imply to sum up the total weightings assoiated with both x and y data points.

Thanks for your help.
 
  • #6


If there are n datapoints, there are n weights. Weight w1 is used for both x1 and y1. Ʃwi is the sum of the n weights.
 
  • #7


haruspex said:
If there are n datapoints, there are n weights. Weight w1 is used for both x1 and y1. Ʃwi is the sum of the n weights.

Such that x1 and y1 take the same weighting?

Basically for my data all the x values have the same weighting, and all the y values have the same weighting - not equal to that of the x values.(where the weighting for each set was deduced by approximating the uncertainty to be half a division of the instrument used.)
 
  • #8


binbagsss said:
Basically for my data all the x values have the same weighting, and all the y values have the same weighting
I doubt weighting in that way will have any effect.
 
  • #9


What the weighting does is effectively multiply the number of occurances of each sample point, including the ability to multiply by a non-integer, such as a weight factor of 1.5 which would mean that a sample point would be treated at 1.5 sample points in the formula, while a weight factor of 0.3 would mean that a sample point would be treated as 0.3 sample points. The "total" number of weighted sample points would be the sum of all the weighting factors.

If you want to use the same formula for non-weighted points, just set all the weighting factors to 1.0.
 
  • #10


rcgldr said:
What the weighting does is effectively multiply the number of occurances of each sample point, including the ability to multiply by a non-integer, such as a weight factor of 1.5 which would mean that a sample point would be treated at 1.5 sample points in the formula, while a weight factor of 0.3 would mean that a sample point would be treated as 0.3 sample points. The "total" number of weighted sample points would be the sum of all the weighting factors.

If you want to use the same formula for non-weighted points, just set all the weighting factors to 1.0.
binbagsss is proposing to apply just two weights, one to all the x terms and another to all the y. I think this is based on the knowledge that one set of values is known more accurately than the other. It's not apparent what one would do with the Ʃwi term in that case, but even if that could be sensibly handled I believe such a weighting would have no effect, or if it had an effect not a desirable one. Can you corroborate that?
 
  • #11


To be more clear, for this assignment we should deduce the gradient via both ordinary square regression , and weighted least square regresion, and then the idea is to compare the values.

The trouble I'm having is with the weighted one and what to use as the weighting in this case, as both the x and y values of each data point have an associated error. I assume that the uncertainties of the x and y, should some how be combined and then this combined uncertainty used to deduce the weighting. One way that I can think of to do this is via a functional approach , however I'm not sure if you are meant to make any assumptions on the function for a weighted least square regression.

(I would just favour either the x and y uncertainties, neglecting the other, however the errors seem relatively comparable).

Thanks again.
 
  • #12


If the x and y uncertainties are fixed instead of relative to the magnitude of x and y, you could base the weighting factors on the ratio of (magnitude of a data point) / (magnitude of uncertainty of that data point). If the uncertainties are relative to the magnitude of x and y, I don't see any point in using weighting factors.
 
  • #13


As I understand it now, there is a known error range in both x and y values, and these can be different at each datapoint. The larger the error range, the smaller the weight to be allocated. Since only one weight can be assigned to each datapoint, it must represent both the x and y uncertainties. A root-mean-square combination sounds reasonable.
rcgldr said:
If the x and y uncertainties are fixed instead of relative to the magnitude of x and y, you could base the weighting factors on the ratio of (magnitude of a data point) / (magnitude of uncertainty of that data point). If the uncertainties are relative to the magnitude of x and y, I don't see any point in using weighting factors.
I reach the opposite conclusion. The weights should be related to the absolute uncertainties, not relative uncertainties.
 
  • #14


rcgldr said:
If the x and y uncertainties are fixed instead of relative to the magnitude of x and y, you could base the weighting factors on the ratio of (magnitude of a data point) / (magnitude of uncertainty of that data point).

haruspex said:
I reach the opposite conclusion. The weights should be related to the absolute uncertainties, not relative uncertainties.

The main thing is the weights should be related to the inverse (1/x) of the uncertainties. Note the ratios I stated was the inverse of the relative uncertainties. An error of ± .001 has more effect on a data value of .01 than it does on a data value of 100, but I'm not sure if or how this should be taken into account.
 
Last edited:
  • #15


rcgldr said:
An error of ± .001 has more effect on a data value of .01 than it does on a data value of 100, but I'm not sure if or how this should be taken into account.
Suppose the plan is to fit some curve to the data then use this as the basis for predicting y values given x values in the future. If the cost function of an error it that prediction is related to the relative error (error/value) then you want the curve to be particularly accurate at small values. This means you want to give data in that part of the curve high credence and stop the curve becoming distorted by errors elsewhere in the data. This argues against basing the weighting on relative error.
 
  • #16


haruspex said:
As I understand it now, there is a known error range in both x and y values, and these can be different at each datapoint. The larger the error range, the smaller the weight to be allocated. Since only one weight can be assigned to each datapoint, it must represent both the x and y uncertainties. A root-mean-square combination sounds reasonable.

Yes that's the problem - thanks for the suggesion of the root-mean square combination - I assume this be more ideal than a functional approach to error propagation, as it does not assume anything about the function?

Thanks again.
 

FAQ: The weighted least squares formula - Quick question

1. What is the weighted least squares formula?

The weighted least squares formula is a statistical method used to minimize the sum of squared errors in a regression model. It takes into account the variability or weight of each data point, giving more weight to data points with lower variability and less weight to those with higher variability.

2. When is the weighted least squares formula used?

The weighted least squares formula is commonly used in regression analysis when the data points have unequal variances or when there is heteroscedasticity present in the data. It is also used in cases where there is a large amount of noise in the data.

3. How is the weighted least squares formula different from ordinary least squares?

The ordinary least squares method assumes that all data points have equal variance while the weighted least squares takes into account the variability of each data point. This makes the weighted least squares more robust and accurate in situations where there is unequal variance in the data.

4. What are the advantages of using the weighted least squares formula?

The weighted least squares formula is advantageous because it gives more weight to data points with lower variability, which leads to a more accurate regression model. It also accounts for heteroscedasticity, a common issue in real-world data, and provides more reliable estimates of the regression parameters.

5. How is the weight for each data point determined in the weighted least squares formula?

The weight for each data point is typically determined by the inverse of the variance of that data point. This means that data points with lower variability will have higher weights, while those with higher variability will have lower weights. In some cases, the weights can also be determined through expert judgment or by using a specific weighting function.

Similar threads

Replies
7
Views
1K
Replies
5
Views
2K
Replies
3
Views
2K
Replies
6
Views
1K
Replies
1
Views
1K
Replies
6
Views
1K
Replies
10
Views
2K
Back
Top