# Fitting Models to Individual Experiments¶

## Basic model pipeline¶

Under the hood, models of individual experiments do the following:

- Guess model parameters.
- Calculate the concentrations of all molecular species using guessed binding constants (as well as the titration shot sizes and initial concentrations in the cell and syringe).
- Calculate the heat change per shot using the guess reaction enthalpies and species concentrations from (2).
- Compare the calculated and measured heat changes at each shot.
- Iterate through steps 2-4 using nonlinear regression to find parameter estimates.

## Implemented Models¶

## Example Fit¶

```
import pytc
# Create fitter
g = pytc.GlobalFit()
# Load experiments
a = pytc.ITCExperiment("demos/ca-edta/hepes-01.DH",pytc.indiv_models.SingleSite,shot_start=2)
g.add_experiment(a)
# Fit and show results
g.fit()
print(g.fit_as_csv)
```

## Differences from other modeling approaches¶

**pytc** is implemented with the philosophy that one should model all processes
in the ITC experiment and include them in the fit. These processes include not only
the binding reaction of interest, but also systematic errors in sample preparation
and heat arising from dilution. The latter effects are captured with nuisance
parameters added to standard thermodynamic models of binding:

where \(Q_{i,obs}\) is the heat at injection \(i\) and \(Q_{i}\) is the heat at injection \(i\) arising from the reaction of interest. \(Q_{i,obs}\) differs from \(Q_{i}\) because of systematic concentration errors (\(\alpha\)) and the heat arising from dilution (\(D_{slope}\) and \(D_{intercept}\)). \(\varepsilon\) is the fit residual.

\(\alpha\) scales all heats, accounting for systematic errors in the relative
protein or ligand concentration. This could also be viewed as an apparent
stoichiometry but, following Freire et al.,
we interpret this as “the effective amount of active protein relative to the nominal
value entered as protein concentration.” This term is referred to as the
`fx_competent`

(fraction competent) in **pytc** output. Practically, this
value should be near 1.0. Large deviations from 1.0 may indicate that the model
used does not describe the stoichiometry of the protein or that there is a
problem with the experiment.

The other nuisance parameters, \(D_{slope}\) and \(D_{intercept}\), model
the heat of dilution as a linear function of titrant concentration. This is
equivalent to fitting a straight line through a blank titration and then subtracting
that line from an experimental titration. Rather than subtracting a blank, **pytc**
allows a user to incorporate a blank titration into the global fit: the user
fits the same \(D_{slope}\) and \(D_{intercept}\) across both an
experimental and blank titration, thus explicitly modeling the heat of dilution.

If a one sets the values of \(\alpha\) to 1.0, \(D_{slope}\) to 0.0, and \(D_{intercept}\) to 0.0, and then does not allow them to vary during the fit, one recovers only the thermodynamic model—as is done in software such as Origin.