A life-cycle model of risk-taking on the job