# Find constants A, B and C using a nonlinear regression (e.g. LeastSquares)

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

$\frac{\beta}{f}=A+B+f^C$

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?

• 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. – bill s Oct 19 '17 at 15:23
• Multiply both side of your equation by $f$ and use NonlinearModelFit and follow @bills advice. – 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:

nlmf["BestFitParameters"]

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.

• 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. – JimB Oct 19 '17 at 15:27
• 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. – eyorble Oct 19 '17 at 15:29
• 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.) – bill s Oct 19 '17 at 16:05
• 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. – eyorble Oct 19 '17 at 16:10
• "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.}. – JimB Oct 19 '17 at 16:11