powered by
A quadratic polynomial fitted to the last n observations. We then extrapolate to estimate f(t + s) with s >= 1.
predPoly(x, n, s)
a vector with values from the quadratic predictor.
a vector of data X_t.
the n to define the window size.
the extrapolation parametr s.
Shelemyahu Zacks
data(DOW1941) plot(DOW1941$Date, DOW1941$DOW1941, type="l", ylab="Dow Jones 1941", xlab="Date") lines(DOW1941$Date, predPoly(DOW1941$DOW1941, n = 20, s= 1))
Run the code above in your browser using DataLab