[Scilab-users] evaluate error on each parameter calculated with leastsq
Antoine Monmayrant
antoine.monmayrant at laas.fr
Wed Feb 19 10:32:20 CET 2014
On 02/18/2014 03:06 PM, Yohann wrote:
> Hi all !!
>
> First of all, thank you to all contributors of Scilab.
> However, I have a problem to calculate the estimated error on each parameter
> calculated with leastsq.
>
> For example if I have the simple following function to fit:
> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
> function y = fun2fit(x, c)
> y = c(1)*x*x + c(2)*x + c(3);
> endfunction
>
> function e = myerror(c, x, y)
> e = fun2fit(x, c) - y;
> endfunction
>
> // Data
> x = [ 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 5.5 6]';
> y = [5.02 6.08 3.33 -0.93 -0.22 7.83 16.52 15.55 2.67 -11.42 -11.78
> 5.09 25.25]';
>
> // First guess
> c0 = [1 1 1]';
> y0 = fun2fit(x, c0);
>
> // least square
> [f, copt] = leastsq(list(myerror, x, y), c0)
> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
>
> I'd like to have an estimated error on each of the 3 element of copt.
> Any idea ?
What do you mean?
Do you want a confidence interval or any kind of "error bar" for each
parameter?
Or any way to see how your fit is dependent on each parameter?
If it's the case, you might be interested in bootstraping or
jackknifing: http://en.wikipedia.org/wiki/Resampling_(statistics)
These methods are quite ressource hungry but work quite well to measure
the quality and robustness of your fit.
Cheers,
Antoine
>
> Thanks !
> Y
>
>
>
>
>
> --
> View this message in context: http://mailinglists.scilab.org/evaluate-error-on-each-parameter-calculated-with-leastsq-tp4028696.html
> Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
--
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
Antoine Monmayrant LAAS - CNRS
7 avenue du Colonel Roche
BP 54200
31031 TOULOUSE Cedex 4
FRANCE
Tel:+33 5 61 33 64 59
email : antoine.monmayrant at laas.fr
permanent email : antoine.monmayrant at polytechnique.org
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
More information about the users
mailing list