# How to fit these parameters?

I have more or less non-Igor, but approach question which I have been thinking about for few days now. I need to find best fit parameters to following problem...

I have multiple measurements of 3-5 sample and 3-5 instrumental curves. Data are measured at multiple values of variable x (principally angle) and we have for each measurement may be 300 values, therefore we have Signal(x); where we have ~300 x values.

Samples are at different concentrations, which theoretically scales signal up linearly. Principally, data for each concentration are SignalWithoutBackground (x) = Signal(x) - Bscaling * background(x); Bscaling ~1

If all numbers are well known, it should be true that if we divide SignalWithoutBackground (x) by concentration, all results should be the same : SigConcCorr(x) = (Signal(x) - Bscaling * background(x)) / concentration

Therefore, each concentration measurement has two parameters : “Bscaling” and “concentration”

Now, that task is to take these 3-5 such measurements and run through some optimize or fit routine to find best fit values of "Bscaling" and "concentration" based on the best fit of the data together. Starting conditions = guesses - are known and will be reasonably good - within may be +/-20%.

How do I cast this so Igor Optimize or FuncFit can solve this? It is optimizing 6-10 parameters relating 6-10 data sets together. There is no analytical formula for the shape of the curve and there is some noise on each data point.

I am wondering if the best approach is to use multivariate Optimize and write function which returns sum of least square differences between the pairs of SigConcCorr curves (scaled by uncertainties). For three that would be sum for combinations (S1-S2)+(S2-S3)+(S1-S3). For 4 and 5 it gets bit more tedious, not that bad.

Is that reasonable? Anything already in Igor I am missing? Any better idea I am missing?

Thanks for any suggestions!

As I understand, the value Bscaling varies from instrument to instrument. In that case, you should not seek to obtain one value of Bscaling for all N_i instruments.

Focus then on the data from any one instrument j. You have spectra SWBCj(x) = (Signalj(x) - Bscalingj*Backgroundj(x))/Cj, where Cj is the concentration, from N_c different concentrations. In this case, I would try to write a multi-variant all-at-once fitting to fit the N_c spectra. Based on the discussion in the Igor help, I think this is an example starting point:

wave pw, yw, xws, xwb

// pw[0] = BScaling

// pw[1] = Concentration

// xws -- Signal values

// xwb -- Baseline Values

// presumes that yw, xws, and xwb have same wave scaling

yw = (xws - pw[0]*xwb)/pw[1]

end

The trick after this is to chain the individual spectra Signalj together (concatenate) and to duplicate the Background as many times and then concatenate them as well. You will have ONE wave xws and ONE wave xwb that contain the N_c spectra, one after each other. By example, when each spectrum has ten data points and you have five concentrations (five spectra), xws and xwb will have 50 points total.

June 14, 2020 at 04:32 pm - Permalink

In reply to As I understand, the value… by jjweimer

I have used AllAtOnce fitting combined with concatenated segments of data method before. This was what I thought I will do... But what am I fitting the yw to? All I have are measurements xws and xwb. I can concatentate them together and do all this jazz inside the fit function, but what am I fitting this to?

There is no model for the data. All I have are data and I am trying to tease out correct concentrations and background scalings to correct for user dilution errors and tiny corrections for background scaling.

June 14, 2020 at 07:08 pm - Permalink

The yw is the measured SigConcCorr(x).

Oh ... Wait! You only have measured xbs and xbw. Essentially, you are trying to normalize (non-dimensionalize) all measured data to give the same as yet UNKNOWN result for SigConcCorr(x).

Perhaps this needs another step or two ... e.g. normalize concentration and baseline factor as multipliers to a base zero experiment result.

I believe the all-at-once method is still the approach, but either yw has to be "standardized" or the fitting equation has to be "normalized" differently.

June 15, 2020 at 06:46 am - Permalink

If I have understood correctly, this sounds like what the Global Fit package was designed for.

June 15, 2020 at 11:07 am - Permalink