code for analysising the purchase interval data