I have an asymptotic behavior of $\beta$ with respect to $f$ that is described by a curve:


If I have the following pairs of $(f,\beta)$:

data={{0.1, 0.21}, {0.2, 0.44}, {0.3, 0.69}, {0.4, 0.96}, {0.5, 
  1.25}, {0.6, 1.56}, {0.7, 1.89}, {0.8, 2.24}, {0.9, 2.61}, {1., 3.}};

How can I find the constants $A$,$B$ and $C$ using a nonlinear regression?

  • 4
    $\begingroup$ Having A+B in the right hand side doesn't make all that much sense since the best you will ever be able to do is to identify their sum. $\endgroup$ – bill s Oct 19 '17 at 15:23
  • 1
    $\begingroup$ Multiply both side of your equation by $f$ and use NonlinearModelFit and follow @bills advice. $\endgroup$ – JimB Oct 19 '17 at 15:24

First separate the problem into dependent and independent variables: $\beta$=$f(A+B+f^C)$

Then use:

nlmf=NonlinearModelFit[data, f (a + b + f^c), {a,b,c}, {f}];

This will generate the nonlinear model fit and store it in nlmf. You can extract values at given $f$ by using:

nlmf[0.7] (* for f == 0.7 *)

Or you can extract the parameters by doing:


Note 1: As pointed out in several comments, it is impossible in this model to determine $A$ and $B$ individually, so there's little point to trying to fit both.

nlmf = NonlinearModelFit[data, f (ab + f^c), {ab,c}, {f}];

This could be used to find their sum, but you'll need another condition to find either individually.

  • 1
    $\begingroup$ You need to deal with the issue that @bills pointed out: you can't estimate both $A$ and $B$. You can only estimate their sum. Look at nlmf["CorrelationMatrix"] to see that this is a problem. $\endgroup$ – JimB Oct 19 '17 at 15:27
  • $\begingroup$ This is true, but that's actually an aside to fitting the function with the model, it's just that the model is ambiguously defined. You can't uniquely determine $A$ or $B$, but NonlinearModelFit still found values for them that worked. That probably can't be guaranteed in most cases, but it works for this. $\endgroup$ – eyorble Oct 19 '17 at 15:29
  • $\begingroup$ The sensible thing to do is to rename A and B as D, and then estimate D. (Hint: It will be the sum of A and B.) $\endgroup$ – bill s Oct 19 '17 at 16:05
  • $\begingroup$ I already added that to the answer as a note, although as ab rather than d. That being said, NonlinearModelFit works fine even if they're not combined, it's just that the problem is ill-formed. $\endgroup$ – eyorble Oct 19 '17 at 16:10
  • 1
    $\begingroup$ "but NonlinearModelFit still found values for them that worked." And with no warnings. Shouldn't that be scary? Yes, the predictions are not affected. However, I can certainly image folks "interpreting" the resulting coefficients as meaningful - especially without any warning. One could hope that suspicions would be raised when one looked at the resulting estimates from above: {a -> 1., b -> 1., c -> 1.}. $\endgroup$ – JimB Oct 19 '17 at 16:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.