how rate is calculated