run the avg_estimate.R