Algorithm to determine the optimal parameters of a polynomial Wiener filter–extrapolator for nonstationary stochastic processes observed with errors