updated calculatePurchaseFrequencyAndPurchasetimes()