Re: Linear regression with uncertainties of the independent variable

przemek klosowski via Help-octave <[email protected]> Fri, 4 Mar 2022 17:49:52 -0500
Newsgroups gmane.comp.gnu.octave.general
Message-ID <[email protected]>
On 3/4/22 15:53, Jose Ramom Flores das Seixas wrote:
>
> Hi:
>
> I need to fit some data to a line, (xi,yi), using least squares, 
> taking into account that both the dependent variable (yi) and the 
> independent variable (xi) have uncertainties. The uncertainty is the 
> same for all xi, but varies for different yi. Is there a function in 
> octave that allows this adjustment to be made?
>
> The "LinearRegression" function in the "optim" package allows to fit 
> the data taking into account the uncertainties of the dependent 
> variable, yi, but ,if I understand correctly, it does not consider the 
> uncertainties of xi.
>
If all xi uncertainities are the same (say dx), the least squares sum 
sum(((xfi-xi)/dxi)^2) reduces to dx*sum((xfi-xi)^2) and so the 
minimization should give the same result as if there was no uncertainity 
on xi. I think.


----------
We are transitioning to a web based forum
for community help discussions at
https://octave.discourse.group/c/help