# How to optimize the SRK/T A constant

## The SRK/T formula

The SRK/T formula (1,2) has long been one of the most popular IOL calculation methods : it is still widely used and its optimized constant is often used to tune other formulas.

## What is an optimization ?

Optimizing a formula involves shifting its constant up or down, to obtain a mean prediction error equal to zero.

## SRK/T Optimization process

The following code allows you to obtain the optimized A constant for a given dataset.

The OptimizeSRKT() function takes various variables as inputs : dataframe is the pd.DataFrame() object containing the data; col_AL , col_R, col_power, col_SE are the names of the related dataframe columns (string); aconst_start (float) should be the closest value you can guess for the adjusted A constant. The SRKTES() function calculates the SRK/T SE prediction for a given eye / implanted IOL power.

The function will calculate the predicted SRK/T spherical equivalent, calculate the prediction error for each eye, then its mean for the whole dataset ; by adding the mean error to the A constant (it's a trick !), we'll quickly find the A constant leading to a prediction error equal to zero, which is the adjusted A constant.

```
def OptimizeSRKT(dataframe, col_AL, col_R, col_power, col_SE, aconst_start):
dataframe['aconst'] = aconst_start
dataframe['SRKTES'] = dataframe[[col_AL, col_R, 'aconst', col_power]].apply(lambda x : SRKTES(*x), axis = 1)
dataframe['error'] = dataframe[col_SE] - dataframe['SRKTES']
mean_error = dataframe.error.mean()
while mean_error > 0.00001:
dataframe['aconst'] += mean_error
dataframe['SRKTES'] = dataframe[[col_AL, col_R, 'aconst', col_power]].apply(lambda x : SRKTES(*x), axis = 1)
dataframe['error'] = dataframe[col_SE] - df['SRKTES']
mean_error = dataframe.error.mean()
print('Mean error : ', mean_error)
print('Optimized SRK/T A constant : ', dataframe.aconst.unique()[0])
```

```
# Example :
OptimizeSRKT(df, 'AL', 'R', 'Power', 'ES_postop', 118.0)
# Output :
# Mean error : 0.0773036659614707
# Mean error : 0.007425076192446311
# Mean error : 0.0007240370609196819
# Mean error : 7.070440730831753e-05
# Mean error : 6.90546869455154e-06
# Optimized SRK/T A constant : 119.08180447676536
```

## References

1- Retzlaff JA, Sanders DR, Kraff MC. Development of the SRK/T intraocular lens implant power calculation formula. J Cataract Refract Surg. 1990 May;16(3):333-40.

2- Retzlaff JA, Sanders DR, Kraff MC. Development of the SRK/T intraocular lens implant power calculation formula: Erratum. J Cataract Refract Surg. 1990;16(4):528.