Learn R Programming

mewAvg (version 0.3.1)

mewAccum: 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

Value

The updated instance of av

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.

Examples

Run this code
# NOT RUN {
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)
}

# }

Run the code above in your browser using DataLab