masPred1: Moving Average Smoothing Predictor

View source: R/masPred1.R

masPred1R Documentation

Moving Average Smoothing Predictor

Description

A moving average smoother is a sequence which replaces X_t by a fitted polynomial based on the window of size n = 2m + s around X_t. The simplest smoother is the linear one.

Usage

masPred1(x, m, s)

Arguments

x

a vector of data X_t.

m

the m to define the window size.

s

the s to define the window size.

Value

a vector with values form the linear smoother predictor.

Author(s)

Shelemyahu Zacks

Examples

set.seed(123)
x <- 1:20 + rnorm(20, 0, 0.1)
masPred1(x, m = 3, s= 1)
masPred1(x, m = 3, s= 3)

data(DOW1941)
plot(DOW1941$Date, DOW1941$DOW1941,          
     type="l", 
     ylab="Dow Jones 1941", xlab="Date")
lines(DOW1941$Date, masPred1(DOW1941$DOW1941, m = 3, s= 1))

mistat documentation built on March 7, 2023, 6:43 p.m.