calculate goodness of fit

조회 수: 17 (최근 30일)
Neha
Neha 2014년 2월 20일
편집: Matt J 2015년 11월 27일
I have a data set which looks like this
I have around 7 equations like
y=atp*kcat*Et.*x ./ (kd_A*km_g + km_g*atp + km_a*x + atp*x.*(1+x./ksi));
y=atp*kcat*E.*x ./ (km_g*atp + km_a*x.*(1+x./ksi) + atp*x);
and more...
There are 4 - 5 parameters to fit for in each equation and there are 3 - 4 known variables.
One of these equations should be the best fit for the data and I want to find that. I tried using lsqcurvefit and got pretty good results. But similar values fpr the variables using all the equations and the resnorm is identical. Is there a way to find the goodness of fit? And am I doing it correct?

채택된 답변

Star Strider
Star Strider 2014년 2월 20일
편집: Star Strider 2014년 2월 20일
If you have the Statistics Toolbox, I suggest fitnlm. It produces a number of useful statistics. To the best of my knowledge, these aren’t available with lsqcurvefit and the Optimization Toolbox.
As a general rule, if all your functions produce similar residual errors, the model with the fewest parameters to estimate will have the best goodness-of-fit because it has the greatest degrees-of-freedom. The F-statistic may be the best measure, although the likelihood ratio may be best for for comparing two models with the same number of parameters.
That said, there are a number of other techniques to assess regression models. It is too broad a subject to go into here.
  댓글 수: 1
Pitch Mandava
Pitch Mandava 2014년 3월 20일
편집: Pitch Mandava 2014년 3월 20일
There is a webiste on sakai.duke.edu which deals with using F-test for comparing two different models with an example. Hope this link works for everybody. https://sakai.duke.edu/access/content/group/25e08a3d-9fc4-41b0-a7e9-815732c1c4ba/New%20folder/Stat%20Topic%20Files/Non-Linear%20Regression/FTestTutorial.pdf

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

jandas
jandas 2014년 2월 20일
Try to use the fit function
[fitobject,gof] = fit(x,y,fitType)
and have a look at the gof output argument

Matt J
Matt J 2014년 2월 21일
편집: Matt J 2014년 2월 21일
You could use curve fitters from other toolboxes as the others have been telling you. On the other hand, the goodness of fit measures that they return are rather simple functions of the output residual vector and Jacobian that lsqcurvefit does give you. You could easily calculate the goodness of fit metrics yourself.
  댓글 수: 2
Kate Lewis
Kate Lewis 2015년 11월 19일
hi matt - this is a bit belated, but i was hoping you might have a followup on this previous thread.
i've found that i have to use the "lsqcurvefit" because i have to constrain one of my variables in the fit (which i believe is impossible using nlinfit or fitnlm). im trying to evaluate the 'goodness of fit' for my model (R^2, p-value) etc, do you know how to actually code this using the residuals and jacobian output from the lsqcurvefit?
any help would be appreciated! i can't seem to nail this down ..
Matt J
Matt J 2015년 11월 21일
편집: Matt J 2015년 11월 27일
Hi Kate,
The usual formulas for goodness of fit do not apply to constrained problems. However, I assume your constraints are simple bounds LB<=x<=UB, since those are the only kind that lsqcurvefit supports. One can usually re-parametrize such problems as unconstrained e.g., by the change of variables x-->y,
x=(UB-LB)*(sin(y)+1)/2 - LB
Note that x, as given in terms of y above, is inherently bounded to [LB, UB] while y can vary freely.
I would recommend that you solve the problem first in terms of the natural variable x using lsqcurvefit and explicit bounds. Then, re-pose the problem as unconstrained and use nlinfit to obtain goodness of fit output. Because you already know the solution from lsqcurvefit, you can simply pass that solution as the beta0 input to nlinfit, and it will finish in 1 iteration or so, spitting out goodness of fit output with it. Of course, the goodness of fit will be in terms of the new unconstrained variables y. You will have to translate that through the change of variables formula to get things in terms of x.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Get Started with Curve Fitting Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by