Forecasting extreme events in collective dynamics: An analytic signal approach to detecting discrete scale invariance