how rates are calculated