A Rational Basis for Irrational Beliefs and Behaviors