Anticipating the occurrence and type of critical transitions