If I have the following data

Import["https://pastebin.com/raw/1XhEEJCr", "Package"]

Which gives the following Figure:


I have two questions:

Question 1

Is there any way that Mathematica with a code can tell you what is the best fit for this data and give the parameters?.

Question 2

If I wanted to fit this data let's say to the following equation:

r10 E^(-((r00 - x)/r20)) r20^-r30 (r00 - x)^(-1 + r30)

where I am using the following code

NonlinearModelFit[data,r10 E^(-((r00 - x)/r20)) r20^-r30 (r00 - x)^(-1 + r30), {{r10,0.62}, {r20, 0.5}, {r30, 22}}, x];

Is there any way to ask Mathematica or to know what would be the best guesses for this or any data?.

For this case the guess values for r10,r20 and r30 are not correct and I am not sure how I will go about finding the best guess to try to fit this data to that equation and see if that fits or not.

Thank you

  • 4
    $\begingroup$ 1) No: a sensible model must come from the physical meaning of the data; No algorithm can do that reliably. 2) Not really; in fact, a good choice of initial values is often the most difficult yet important choice in fitting data sensibly. $\endgroup$ – MarcoB May 12 '20 at 5:12
  • 3
    $\begingroup$ Question 2): You could use NonlinearModelFit without starting values: NonlinearModelFit[data,r10 E^(-((r00 - x)/r20)) r20^-r30 (r00 - x)^(-1 + r30), {r10 , r20 , r30 }, Method -> "NMinimize"] . By the way, are you sure about your modelfunction? I would expect the exponential term to be Exp[- (r00-x)^2 …] $\endgroup$ – Ulrich Neumann May 12 '20 at 8:30
  • $\begingroup$ @UlrichNeumann thanks! The model of question 2 seem to fit other curves that are similar to the one posted. The model was suggested by JimB here: mathematica.stackexchange.com/questions/221229/… $\endgroup$ – John May 12 '20 at 17:02
  • 1
    $\begingroup$ @John Try NonlinearModelFit[…,x,Method->"NMinimize"] $\endgroup$ – Ulrich Neumann May 12 '20 at 19:00
  • 1
    $\begingroup$ @John Your yellow-plot shows something like a bell curve, that 's why I would expect a squared exponent Exp[- (r00-x)^2 …] in your model! Unfortunately I cannot excess your data... $\endgroup$ – Ulrich Neumann May 12 '20 at 19:06

Your Answer

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

Browse other questions tagged or ask your own question.