Perform inverse weighted least squares regression

11 views (last 30 days)
I have a dataset for a calibration curve that is linear, but due to the nature of regular least squares regression, the regression line is far less accurate at the lower end of the curve. This is due to the fact that linear regression minimizes the sum of squares of absolute error.
To get a more accurate fit at the lower end of my dataset, it has been reccomended to use an "Inverse Weighted Linear" regression. This is performed by minimizing the sum of squares of (1/error). In theory this makes perfect sense, the regression will fit much better at the lower end of the dataset, which is what I need.
However, I have not been able to find a tool that can do this, nor have I figured out how to do it by hand. When I search weighted linear, the results imply that I should know the weight of each datapoint. Would this be 1/error of each point?

Accepted Answer

Star Strider
Star Strider on 16 May 2021
Would this be 1/error of each point?
That would appear to be a reasonable approach, since the data with the smallest errors would get large weights, and the data with large errors would get smaller weights.
There are several linear and nonlilnear parameter estimation techniques that do this automatically, for example nlinfit and specifically the section on Nonlinear Regression Using Observation Weights.
  2 Comments
Aaron Goodman
Aaron Goodman on 16 May 2021
Thanks for the response!
Are there any tools to do this while keeping the regression linear?
Ideally I'd just like to use the same exact least squares idea, but simply change it so that it minimizes the sum of squares of 1/error.
Star Strider
Star Strider on 16 May 2021
Sure! However ‘curve’ implied nonlinear to me, so I went there first.
The fitlm function does linear regression, and has the option to include an observation Weights vector.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!