Message Boards Message Boards

0
|
345 Views
|
6 Replies
|
3 Total Likes
View groups...
Share
Share this post:

Speeding up the fitting of a model with 23 parameters using NonLinearModelfit

Posted 11 days ago

I have an experimental dataset. Data points are of the type {w,y} where w is the frequency and y is experimental absorbance. I want to fit this data with a spectroscopic line profile using NonLinearModelfit function in Mathematica. Size of data is about 500 points and the number of parameters to be fitted around 23-28. It is taking lot of time around 7-8 hours. I cannot divide my dataset and compute parallelly because in that case there will be no consistency of the fitted parameters across the divided datasets. Then how to faster the process? Any suggestions?

POSTED BY: Rajesh Chell
6 Replies
Posted 9 days ago

It's not easy to help without seeing the data, some of the functions (unperturbedFrequency, etalon, background, and areaFunc), and numerous constants (shift, crossoverFrequency, paramstobefitted, Areaparamstobefitted, BGparamstobefitted, and etalonParamstobefitted).

I understand that you need consistency among the subsets of the data but first fitting those subsets separately might help get starting values for the fitting of the complete set of data.

Also, when you do arrive at a result, you need to look at the parameter correlation matrix which you can find with myFit["CorrelationMatrix"]//MatrixForm. With that many parameters it will not be surprising if some of the correlations are very near -1 and +1 which indicates overparameterization.

POSTED BY: Drjbaldwin
Posted 8 days ago

Hii , I have uploaded the full code and 8 data files. Please find them.

POSTED BY: Rajesh Chell
Posted 8 days ago

In my previous reply I uploaded 4 datasets, here I uploaded other 4 datasets.

POSTED BY: Rajesh Chell
Posted 7 days ago

Thanks for posting the code and data. You'll think I'm never satisfied but your code is just too long and complicated for me to follow. If you can, posting a minimal working example is what is needed.

For example, to import the data, shift the horizontal values in increments of 30, and plotting the result can be done in far fewer steps:

d = ConstantArray[0, 8];
Do[d[[i]] = Import["data" <> ToString[i] <> " " <> ToString[i] <> "0 Torr.CSV"];
  d[[i, All, 1]] = d[[i, All, 1]] + 30 (i - 1), {i, 1, 8}]
ListPlot[Flatten[d, 1], Joined -> True, PlotRange -> All]
POSTED BY: Drjbaldwin

Rajesh,

What is the form of your equation that you are trying to fit?

POSTED BY: Neil Singer
Posted 9 days ago

Please find the attached notebook (the part of my code). Here my fitted function is complete profile and the fitted parameters (in the form of list) are- paramstobefitted, Areaparamstobefitted, BGparamstobefitted, etalonParamstobefitted . These are parameter lists in the form they appear in profile function. This code works well but taking lots of time. Can you please help??

POSTED BY: Rajesh Chell
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract