Learn R Programming

mistat (version 2.0.4)

predPoly: Quadratic Predictor

Description

A quadratic polynomial fitted to the last n observations. We then extrapolate to estimate f(t + s) with s >= 1.

Usage

predPoly(x, n, s)

Value

a vector with values from the quadratic predictor.

Arguments

x

a vector of data X_t.

n

the n to define the window size.

s

the extrapolation parametr s.

Author

Shelemyahu Zacks

Examples

Run this code
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