A behavioral model of the credit cycle