A dynamic model of customer loyalty