mewAccum: Update the class 'mewTyp'

Description Usage Arguments Details Value Examples

Description

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

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
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)
}

mewAvg documentation built on May 2, 2019, 6:20 a.m.