# Model Fitting

## Alternative Models

Models of run velocity include a Gaussian Distribution, or the Maxwell Distribution which govern the velocities and energies of molecules. An exponential distribution may describe the memoryless characteristic of run duration. We will build up a database of models, for future model fitting.

### Mechanical Model

We have created a simple mechanical model of motile bacteria, depicted in the figure below.

## Fitting Models to Data

In this first level of inference, we apply Bayes' Theorem. We first assume a particular model, and go on to derive the parameters of our model which maximises the data obtained.

### Mechanical Model

The following trajectories were fitted based on the above equations, and corresponding parameters determined:

 Cell 1 Cell 2 100908 Video 15 Cell 1 Trajectory 100908 Video 15 Cell 1 Trajectory A=[-102.2628 -67.2227] B=[362.5003 -92.3339] alpha=0.2500 A=[-109.7191 -7.7453] B=[219.2134 -154.1100] alpha=0.4342

 Cell 3 Cell 4 100908 Video 15 Cell 1 Trajectory 100908 Video 15 Cell 1 Trajectory A=[57.0606 -29.0868] B=[12.0191 25.8818] alpha=2.4867 A=[28.8774 116.5196] B=[-790.7562 -1162.5363] alpha=0.1231

In some cases, we can visually segment the cell's trajectory into two or more separate runs. In the case below, we see that if we fit the cell's trajectory to only one run and a single set of parameters, we do not obtain a satisfactory fit. However, if we introduce an orientation change at a user selected frame, we are able to obtain a better fit. This fit contains two runs, thus generating two sets of parameters for the two runs.

 Cell 6 trajectory fitted with single run Cell 6 trajectory fitted with two runs 100908 Video 15 Cell 6 One Run 100908 Video 15 Cell 6 Two Runs A=[164.3967 -56.7380]B=[-1295.3312 991.4668]alpha=0.1442 A1=[95.6096 60.9460], A2=[86.4716 -46.1687]B1=[-492.7792 10.5021], B2=[-108.9051 296.9050]alpha1=0.2430, alpha2=0.3563

 Cell 8 trajectory fitted with single run Cell 8 trajectory fitted with two runs 100908 Video 15 Cell 8 One Run 100908 Video 15 Cell 8 Two Runs A=[-180.6859 -119.7534]B=[1304.1386 1803.01403]alpha=0.1250 A1=[-85.1818 43.1377], A2=[-84.9777 -9.8265]B1=[164.3084 113.5167], B2=[2.5833 11.6861]alpha1=0.4465, alpha2=2.2476

## Assigning Preferences to Alternative Models

In this second level of inference, we use the evidence contributed by the data to compare fitted models. Using Occam's Razor, we are then able to deduce the best model which fits our data.