[Scilab-users] errors (uncertainties) in non-linear least-squares fitting parameters

Heinz Nabielek heinznabielek at me.com
Mon Aug 24 23:58:37 CEST 2020


On 24.08.2020, at 23:08, Rafael Guerra <jrafaelbguerra at hotmail.com> wrote:
> 
> Hi Heinz,
>  
> For the regression errors, I am not an expert but from wikipedia or from reference below, I would risk the following code (at your peril):
> https://pages.mtu.edu/~fmorriso/cm3215/UncertaintySlopeInterceptOfLeastSquaresFit.pdf
>  
> // Note: for degrees of freedom>=6, t-distribution ~2
> N = length(MW);
> mx = mean(MW);
> SSxx = sum((MW -mx).^2);
> Ea = diag(2*sig/sqrt(SSxx))  // take Ea diagonals; slope 95% confidence 
> Eb = diag(2*sig*sqrt(1/N+mx^2/SSxx)) // take Eb diagonals; intercept 95% confidence
>  
> Concerning the least squares regression part, it seems the code may be written more compactly using reglin:
>  
> [a,b,sig]=reglin(MW',Y') // simple least squares linear regression
> GG= a.*.xx' + repmat(b,size(xx'))
> plot(xx,GG','LineWidth',1);


Here is a little misunderstanding (my fault: I had not explained it).
I want all three straight lines to go simultaneously through one point at the negative x-axis. This is why I had to use a non-linear least-squares fit.

Heinz




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20200824/56ef01c9/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PastedGraphic-2.tiff
Type: image/tiff
Size: 51378 bytes
Desc: not available
URL: <https://lists.scilab.org/pipermail/users/attachments/20200824/56ef01c9/attachment.tiff>


More information about the users mailing list