The weighted least squares formula - Quick question

Click For Summary

Homework Help Overview

The discussion revolves around the weighted least squares formula, specifically addressing the interpretation of weights associated with data points in the context of regression analysis. Participants are exploring how to appropriately apply weightings to both x and y values, considering the implications of uncertainties in their measurements.

Discussion Character

  • Conceptual clarification, Assumption checking, Mathematical reasoning

Approaches and Questions Raised

  • Participants are questioning how to incorporate weightings for both x and y values in the weighted least squares formula. There is discussion about whether weights should be treated separately for x and y or if a combined approach is necessary. Some participants are also considering the impact of fixed versus relative uncertainties on the weighting factors.

Discussion Status

The discussion is ongoing, with various interpretations of how to apply weightings being explored. Some participants have suggested methods for determining weights based on uncertainties, while others are questioning the validity of these approaches. There is no explicit consensus, but several productive lines of reasoning are being developed.

Contextual Notes

Participants are working under the constraints of a homework assignment that requires comparing results from ordinary least squares regression and weighted least squares regression. The uncertainties associated with both x and y values are a significant point of discussion, with suggestions for combining these uncertainties to derive appropriate weights.

binbagsss
Messages
1,291
Reaction score
12
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 a lot !
 
Physics news on Phys.org


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 ?
 


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.
 


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.
 


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.
 


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


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.
 


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.
 

Similar threads

  • · Replies 12 ·
Replies
12
Views
1K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 7 ·
Replies
7
Views
1K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 20 ·
Replies
20
Views
3K
  • · Replies 26 ·
Replies
26
Views
2K
  • · Replies 44 ·
2
Replies
44
Views
4K