using binning to calculate ratio