Last data update: 2014.03.03

R: Update the class 'mewTyp'
mewAccumR Documentation

Update the class mewTyp

Description

Update an S4 object of class mewTyp with a new data point

Usage

mewAccum(xx, av)

Arguments

xx

(vector double) The vector of data with which to update the MEW aveage

av

(class mewTyp) The current state of the MEW average

Details

If av is an S4 object of class mewTyp that contains the current state of the MEW average and xx is a new vector of data, the function mewAccum updates the MEW average with xx.

Value

The updated instance of av

Examples

n_iter <- 1000

av <- mewInit(n_bin = 4, n_xx = 1, ff = 0.5)

for (i in 1:n_iter) {

  value <- runif(n=2)
  value[1] <- ((cos(value[1]*2*pi))^2)*(1 - exp(-0.01*i))
  value[2] <- (-((sin(value[2]*2*pi))^2))*(1 - exp(-0.01*i))
  value <- as.double(value)

  av <- mewAccum(xx = value, av = av)
}

Results