Subtract centered moving averages from y's. Take the differences, and arrange into n(n=3) columns to derive P's and average values along columns.