Nonanticipating estimation applied to sequential analysis and changepoint detection