Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

ewmaSmooth

EWMA smoothing function


Description

Compute Exponential Weighted Moving Average.

Usage

ewmaSmooth(x, y, lambda = 0.2, start, ...)

Arguments

x

a vector of x-values.

y

a vector of y-values.

lambda

the smoothing parameter.

start

the starting value.

...

additional arguments (currently not used).

Details

EWMA function smooths a series of data based on a moving average with weights which decay exponentially.

For each y_t value the smoothed value is computed as

z_t = λ y_t + (1-λ) z_{t-1}

where 0 <= lambda <= 1 is the parameter which controls the weights applied.

Value

Returns a list with elements:

x

ordered x-values

y

smoothed y-values

lambda

the smoothing parameter

start

the starting value

Author(s)

Luca Scrucca

References

Montgomery, D.C. (2005) Introduction to Statistical Quality Control, 5th ed. New York: John Wiley & Sons.
Wetherill, G.B. and Brown, D.W. (1991) Statistical Process Control. New York: Chapman & Hall.

See Also

Examples

x <- 1:50
y <- rnorm(50, sin(x/5), 0.5)
plot(x,y)
lines(ewmaSmooth(x,y,lambda=0.1), col="red")

qcc

Quality Control Charts

v2.7
GPL (>= 2)
Authors
Luca Scrucca [aut, cre], Greg Snow [ctb], Peter Bloomfield [ctb]
Initial release
2017-07-09

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.