Goodness of Fit - Error Bars
Ältere Kommentare anzeigen
I'm currently using the fminsearch function in order to find a best fit curve to a non-analytic function. However, I would also like to be able to find error bars on my fit parameters, say at a 95% confidence level.
I don't have any experience with statistical analyses, and have been relying on built in fit functions to obtain error bars in the past. Is there any good way to do that without drastically altering my program?
To give a bit more information about my program: I am solving a system of equations with given parameters p(1), p(2), p(3), and then subtracting experimental data, x. The fminsearch function searches for optimal p by referencing a function (here, "functionname") which computes the quadratic mean (RMS) RMS(f(p)-x)
[poptimal, fval] = fminsearch(@functionname, p0);
I'd like to comment ahead of time that I don't want errorbars on the graph of my function or anything like that. I just want to know, for example, that p(1) is equal to 3e-6 +/- 2e-7 with 95% confidence.
Akzeptierte Antwort
Weitere Antworten (1)
Clement Wong
am 30 Jul. 2011
0 Stimmen
2 Kommentare
the cyclist
am 30 Jul. 2011
I disagree with you. Here is a simple set of (x,y) data. In the first call to nlinfit(), I use the model y = P*x. In the second call, I used y = (P1+P2)*x. The first call works fine. The second call gives me a warning that the Jacobian is ill-conditioned, and the covariance matrix of the parameter estimates is of order 1e27. This is exactly the behavior I would expect. [Sorry that the code will probably be very poorly formatted, but there is no markup in comments.]
% Pretend data
x = 1:8;
y = 3*x + 0.4*rand(1,8);
% Well parameterized model
f = @(p,x) p(1)*x;
beta0 = [1];
[beta,r,j,covb,mse] = nlinfit(x,y,f,beta0)
% Poorly parameterized model
f = @(p,x) (p(1)+p(2))*x;
beta0 = [1 1];
[beta,r,j,covb,mse] = nlinfit(x,y,f,beta0)
Clement Wong
am 1 Aug. 2011
Kategorien
Mehr zu Creating, Deleting, and Querying Graphics Objects finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!