Learn R Programming

spc4sts (version 0.6.3)

twms: Time-Weighted Moving Statistic

Description

Computes time-weighted moving statistics EWMA or tabular CUSUM

Usage

twms(x, type = c("ewma", "cusum"), lambda, mu0, K, x0 = 0)

Arguments

x

the vector of observations to compute the time-weighted moving statistic for.

type

the type of statistic used in the computation.

lambda

the parameter of EWMA

mu0

the mean of the observations

K

the parameter of tabular CUSUM

x0

the starting value for the time-weighted moving statistics.

Value

the EWMA or tabular CUSUM statistics

Examples

Run this code
# NOT RUN {
z <- twms(1:10, "ewma", lambda=0.2)
C <- twms(1:10, "cusum", mu0=5, K=1)
# }

Run the code above in your browser using DataLab