EXFIT: help and advice

EXFIT: help and advice


Consult the reference manual (w_manual.pdf) and tutorials (w_examples.pdf) for further details and worked examples.
W.G.Bardsley, University of Manchester, U.K.

Note: sv_exfit only fits a small subset of the models fitted by exfit.

Fitting exponential functions

Fitting sums of exponential functions

This program normalises data, locates starting estimates automatically by bootstrapping refined by random search, then fits y = f(t) by weighted least squares as given by one of the following six generalised, i.e. model free, parameterisations.
It is important to choose the correct model depending on the data. For instance, only if the data clearly indicate that f(0) is nonzero should models 2 or 4 be chosen rather than models 1 or 3 otherwise the fitting procedure can become unstable.
Note that in this program the model parameters are unconstrained so that exponential underflow or overflow can happen. If this is reported then the model you are attempting to fit is probably inconsistent with the data.

  1. Monotonic decline to zero, e.g. following a bolus injection

    f(t) = A(1)exp[-k(1)t] + A(2)exp[-k(2)t] + ... + A(n)exp[-k(n)t]

  2. Monotonic decline to a baseline, e.g. following a bolus injection

    f(t) = A(1)exp[-k(1)t] + A(2)exp[-k(2)t] + ... + A(n)exp[-k(n)t] + C

  3. Monomolecular monotonic growth from zero to an asymptote

    f(t) = B(1){1 - exp[-k(1)t]} + ... + B(n){1 - exp[-k(n)t]}

  4. Monomolecular monotonic growth from a baseline to an asymptote

    f(t) = B(1){1 - exp[-k(1)t]} + ... + B(n){1 - exp[-k(n)t]} + C

  5. Elimination kinetics from zero to zero, e.g. following an oral dose

    As 1 but ... A(n-1) = -A(n) and n > 1, i.e. up/down or down/up type

  6. Transient response from baseline to baseline, e.g. following an oral dose

    As 2 but ... A(n-1) = -A(n) and n > 1, i.e. down/up or up/down type

Here t = time, y = expected response, C = baseline constant. The order number n can be fixed or varied to fit sequences of models of increasing order. Models (1), (3) and (2), (4) only differ in definition of parameters, but 5 and 6 are special cases. The order may equal the number of compartments or chemical species or be less depending on the reaction scheme.

Often you only require order n = 1 but, if your data are good or have turning points, see if n = 2 gives any statistically significant improvement. Only if the data are very extensive and of high quality is there any point in trying n >= 3, and the parameter estimates will probably be of little value anyway.

You should use the facility to plot demonstration examples to clarify the classification into 6 types, and fit the test files provided before attempting to analyse your own data.

Prepare/edit/weight data files using MAKFIL/EDITFL.

Choosing the correct model

It is important to select the correct model for your data, otherwise sensible starting estimates may not be found by the bootstrap and random search procedures, so a good fit may not result. The program is set up to expect y >= 0, t >= 0, k(i) > 0 and C >= 0 but A(i), B(i), C and k(i) can be > 0 or < 0. Defining F > C >= 0 the curve types anticipated are:

  1. y(t) decreases monotonically from y = F when t = 0 to an asymptote y = 0 at large t (exponential decay to zero). This model would be selected to estimate AUC after a bolus injection at t = 0, but would not be selected for elimination following an oral dose.
  2. y(t) decreases monotonically from y = F when t = 0 to an asymptote y = C at large t (exponential decay to constant). This model cannot be used to calculate AUC which is, of course, infinite when a constant is included in the model.
  3. y(t) increases monotonically from y = 0 when t = 0 to an asymptote y = F at large t. This model cannot be used to estimate AUC but is useful for modelling growth processes.
  4. y(t) increases monotonically from y = C when t = 0 to an asymptote y = F at large t. It is used as for type 3.
  5. y(t) increases from y = ? when t = 0 to a maximum value then declines to y = 0 at large t (n > 1). This is used to estimate AUC following an oral dose as it models the increasing phase as well as the elimination phase.
  6. y(t) increases from y = ? when t = 0 to a maximium value then declines to y = C at large t, or else:- y(t) decreases from y = ? when t = 0 to a minimum value then increases to y = C at large t (n > 1). This model cannot be used to estimate AUC of course, but it finds use in experiments where there is a nonzero baseline and response following an oral dose. the response can be up then down or down then up.
  7. If models of type 5 or 6 are selected, you will be given the opportunity to add a further curve fit in which the constraint that A(n) = A(n-1) is relaxed and another curve fit is attempted, using the already estimated parameters as new starting estimates. This is to allow fitting of curves where f(0) may not be quite equal to f(infinity) but where turning points are required. It is not at all certain that such retrospective fits of Type 1 will be any better than fits of type 5 or 6, and they may lead to physically unrealistic parameter estimates. For instance, if it known that a plasma level is truly zero when a drug is ingested and that complete elimination of the drug occurs, then this option must be switched off.
Note that area under the curve (AUC) is only meaningful for model 1, and the difficulty of fitting is as follows:
type 6 >> type 5 >> type 4 = type 2 > type 3 = type 1

Some technical details

The exponential functions fitted by this program can be either positive or negative, and they are defined for both positive and negative time t. So there is no absolute reason why your data must be in order of increasing t, and there is no real reason why you should choose units of measurement such that t and y must be positive. However, fitting exponential sums is very complicated, and this program attempts to find starting estimates automatically, then scale everything to order unity in internal coordinates to facilitate fitting. The algorithm simply works best with increasing t and with y and t positive. Choose baseline and units for your data appropriately.

Note that if the parameter values become so extreme that the exponential function cannot be evaluated, overflow and underflow are trapped to avoid program crash. Warnings about exponential underflow or overflow are merely output so that you will appreciate that the fitting problem is a difficult one that may lead to a poor fit due to insufficient data, an incorrect model, and/or bad starting estimates.

Due to the fact that the order of parameters is arbitrary except that amplitudes and exponents are linked pairwise, this program rearranges parameters so that amplitudes are output in decreasing order of absolute magnitude. This must be carefully observed if the facility to store covariance matrices and parameter estimates for retrospective testing is selected.

Test files

exfit.tf1 and exfit.tf2 should be used with model 1 with n fixed at 1 (just fit one exponential).

exfit.tf3 and exfit.tf4 should be used with model 1 but with n = 1, then n = 2 (fit 1 then 2 exponentials)

inrate.tf2 can be used with model 4 and n fixed at n = 1

exfit.tf5 should be used with model 5 and n fixed at n = 2

exfit.tf6 should be used with model 6 and n fixed at n = 2

exfit.tf7 should be used with model 3

Pharmacokinetics

Exponential functions are used in drug elimination studies for two main reasons.

1) Each compartment in compartmental models contributes an exponential term to the sum.

2) In model free pharmacokinetics, sums of exponentials are useful empirical models that often fit well.

In model free pharmacokinetics or in compartmetal analysis it is of interest to estimates the area under the curve from t = 0 to t = infinity (AUC), as well as the actual area under the curve between the first and last time points. After each exponential model has been fitted by EXFIT these parameters are given, so you can estimate clearance and bioavailability, except that AUC is only defined for models 1 and 5. For bolus injection use model 1 while for ingestion use model 5 with at least 2 exponentials. Very strong evidence is required for 3. To use the trapezoidal rule for AUC, try program AVERAGE or, to fit cubic splines for data smoothing try programs COMPARE or SPLINE.

A particularly difficult problem is fitting curves which have a rapid increase followed by a slow decline, e.g. elimination kinetics following an oral dose. Usually there are only a few points on the increasing part of the curve so, as these then contribute little to the overall fit, models of type 1 usually result in a monotonically declining curve. The solution is to fit models of type 5 or to add extra theoretical points at f(0) = 0, or f(0) = baseline, to the data set to force a type 1 curve to find a type 5 curve. If f(0) is small but not zero then it may be best to fit a model of type 5, then use the parameter estimates as starting estimates for a curve of type 1. This can be done automatically by selected the option to add a further relaxation fit. If a precise pharmacokinetic model can be formulated, then it is preferable to use program QNFIT with a user defined model rather than to use the model free exponential format supported by program EXFIT.

Advice

Fitting exponential functions to data is very problematical. The case of one exponential is usually easy and the program may locate a global minimum. Fitting two exponentials is much more difficult, while the fitting of three or more is rarely justified on statistical grounds, since it leads to very poor parameter estimates and ill-defined local minima. Higher order models should only be accepted if the statistical tests support increased order, and this is also justified by observing a significant contribution of all sub functions to the overall sum in a graphical deconvolution plot.

This program performs a random search for starting values, which may be successful with monotonic y = f(t) profiles. However, chemical and pharmacokinetic schemes sometimes lead to f(t) profiles with turning points, due to terms such as

y = {exp[-k(1)t] - exp[-k(2)t]}/(k2 - k1), etc.

To fit such schemes needs n > 1 and models 5 or 6. If a precise model is known, as often happens in pharmacokinetics or enzyme kinetics, it may be preferable to fit using program QNFIT with a user defined model.

Input starting estimates if the random search fails, but, if you find that manual input of starting estinates is required, you should really be using program QNFIT in the Expert mode or with a parameter limits file.

Try to normalise your data so that models 1, 3, or 5 can be used (i.e. C = 0) but, if in doubt, choose model 2.

For more details see Bardsley et al Biometrika (1986) 73, 501-508) Explanations for the run-time options provided by this program

  1. Choose the sequence of functions required
    • Lowest order (>= 1)
    • Highest order (=<   2)
    You can fit just one model if required by setting Lowest order = Highest order. Or, if the data are extensive (i.e. approaching the final horizontal aymptote) and of high quality, you can also try fitting the next model in the series in sequence to see if the better fit can be justified. Only in exceptional circumstances would order >= 3   be justified by the statistical tests employed by this program. Note that models 5 and 6 require minimum order 2.

  2. Choose the method to use for parameter starting estimates
    • Short Random search
    • Medium Random search
    • Extensive Random search
    • You input starting estimates
    This program scales the data internally to order unity by estimating the slope at the origin from the first few data points and the final asymptote from the last few data points. To improve upon the starting estimates obtained by this process a short random search can be used to seek for better starting estimates. When trying to fit higher order models a medium or extensive search can be used but, with order >= 3, it will normally be required to input your own starting estimates obtained by previous experimentation. In such cases it would probably be better to add the starting estimates to the data file using the {begin limits} ... {end limits} construction and use program QNFIT in the expert mode.

  3. Choose the procedures required for this analysis
    • Display the goodness of fit analysis
    • Display values of starting estimates
    • Display details of any random search
    • Plot the best fit curves and data
    • Provide options to plot residuals
    • Display tables of (wtd.) residuals
    • Write residuals to results log file
    • Use analytic-gradient/high-precision
    • Store/test parameters/covariance-matrix
    • Use the relaxation method with models 5 and 6
    • Display graphical deconvolution for order > 1

If all these options are switched off, the program will simply calculate the fit then display a table of parameter estimates. However the default options also output goodness of fit criteria and plots of the data with best-fit curves. There is also an option to store the estimated parameters and covariance matrices for retrospective invesigation concerning model discrimination. Note that, when fitting models in sequence of increasing order, statistical tests are output for model discrimination. However, the most convincing argument for accepting a higher order model is to plot the contribution of the independent sub-models to the fit, which is loosely described as graphical deconvolution. Note that SIMFIT provides a facility to extract tables from the results log files to import into LaTeX documents or word processing programs.

When fitting models 5 and 6 a simple equation is first fitted with fewer parameters that models a specific set of initial conditions that may not be justified. In such cases, a relaxation technique can be used which involves re-fitting a richer model using the parameters from the simple fit as starting estimates, followed by statistical tests to see if the extra parameters can be justified.

Sometimes there is a backgound signal and the best way to remove this is to estimate it independently then subtract it from the data before fitting. Program EXFIT also allows the estimation of such background factors by estimating a correction parameter but this should only be requested when absolutely necessary, such as when the background noise changes unavoidably between experiments, as it makes fitting much harder.