# fitting different data sets with one same model with NonlinearModelFit [duplicate]

I have a bunch of list data sets, like 6 or 8 of them. They are 2D and look similar. Both x axis and y axis have variance (in each measurement, x axis also changed a little bit).I know the fitting curve is roughly a exponential decay, and I can fit each of them by NonlinearModelFit.

Of course, I can get the average of them then fit. But Here I want to fit all of them simultaneously using NonlinearModelFit.

If this had been talked before, can someone give me a link? All I found is fitting different data sets with different model so far.

Best.

• Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour and check the faqs! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! Feb 25, 2019 at 18:32
• For your question it would help to put some example data that you are wanting to fit . Ideally this would be formatted in a way that people can test directly on the code/data that you have already tried. This will make it much more likely for someone to try answering your question. Feb 25, 2019 at 18:34
• If you "Search on Mathematica..." for "fitting multiple datasets", you'll find several. But in doing so you need to recognize that some approaches assume the same error variance (which might not be a reasonable assumption). I'm not sure what you mean by "x axis also changed a little bit". The ranges of the predictor values are not the same? And the more ominous statement is "Both x axis and y axis have variance (in each measurement". If the predictors have errors, you'll need to consider en.wikipedia.org/wiki/Errors-in-variables_models. Ask on CrossValidated.
– JimB
Feb 25, 2019 at 18:35
• Hi Jim, I am not sure whether I made my statement clear. I think what I want to do is to generate a single fit curve. And this is the best fit when considering all 6 or 8 data sets, where maybe the chi square/least square is the smallest. This is more like a fit+average combined process. Since what you gave me is to fit different data sets individually, although the model is same. Feb 25, 2019 at 19:50
• I would say that your statements do not use very precise terminology and I'm not expecting language from a Ph. D. statistician. From what you describe there is no place for a chisquare test statistic. If all you're trying to do is combine datasets for a single model, then your issue is about commands like Join or Append but not about fitting a model. Maybe each dataset's model shares some common parameters. That would be a statistical issue. So, yes, what you want could use some additional clarity. Giving what you've tried with "altered datasets" to protect the innocent would help.
– JimB
Feb 25, 2019 at 20:54