Resilience indicator for ecosystems subject to high risk of irreversible degradation: a probabilistic method based on Bayesian inference