An economic analysis of the timing of childbirth