masPred1: Moving Average Smoothing Predictor

Description Usage Arguments Value Author(s) Examples

View source: R/masPred1.R

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

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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 April 18, 2021, 5:07 p.m.