Updated analysis script to include calculation of AIC