The risks of parenthood. I. General theory and applications