ma: Moving average of a time series

Description Usage Arguments Value Author(s) See Also Examples

View source: R/ma.R View source: R/regpro.R

Description

Computes a one-sided weighted moving average from a univariate time series. The one-sided moving average can be used to predict the next value of the sequence.

Usage

1
ma(x, h=1, kernel="exp", k=length(x))

Arguments

x

n vector; the observed values of the time series

h

a positive real number; the smoothing parameter of the moving average

kernel

a character; determines the kernel function; either "exp", "uniform", "gauss", or "bart"

k

a positive integer; the moving average includes at most k observations

Value

a real number

Author(s)

Jussi Klemela

See Also

kernesti.regr,

Examples

1
2
3
4
set.seed(1)
n<-100
x<-runif(n)
ma(x)

regpro documentation built on May 29, 2017, 1:40 p.m.

Search within the regpro package
Search all R packages, documentation and source code