Anticipating Critical Transitions With Nonlinearity, Periodicity And Heterogeneity