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

Rafael Guerra jrafaelbguerra at hotmail.com
Mon Aug 24 23:08:49 CEST 2020


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


Regards,
Rafael

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20200824/0811d7c3/attachment.htm>


More information about the users mailing list