    Next: The LocalAlignBestPam Function Up: The Pairwise Comparison of Previous: Estimating PAM Distances

# The FindBestPam Function

The function FindBestPam computes both the average and the variance of the PAM distance of a given alignment. To accomplish this it needs an array of similarity matrices calculated at a rather dense range of PAM distances. The range and coarseness of the array of matrices will have some influence on the accuracy of the computation. By using the variable DMS, set with the command CreateDayMatrices ), these computations tend to be very accurate. For example

```> CreateDayMatrices():                # assign the range of similarity matrices to DMS.
> m := Match(op(Sequence(Entry(8948))), op(Sequence(Entry(8972))));
> m := LocalAlign(m, DM);         # align at 250 PAM
> m := FindBestPam(m, DMS);       # find best PAM number and its variance
```

The PAM distance is in the range delimited by

```> 1.96 * sqrt(m[PamVariance]);
9.7225
> m[PamNumber] - "; m[PamNumber] + "";
11.5157
30.9607
```
with 95% confidence.

For this particular example, the match is short and hence the uncertainty of the PAM distance is large.

These functions are implemented using efficient methods and located within the kernel of the system. The time (in seconds) required to find the alignment and then find the best PAM distance for this alignment are as follows:

```> rtime(LocalAlign(m,DM));
0.01975501
> rtime(FindBestPam(m,DMS));
0.02198303
```

Gaston Gonnet
1998-09-15