Detection of trend changes in time series using Bayesian inference