Are the observation vectors in x stored in rows (TRUE) or in columns (FALSE)?
Details
The forgetting factor f determines the balance between past and present observations in the PCA update: the closer it is to 1 (resp. to 0), the more weight is placed on current (resp. past) observations. At least one of the arguments n and f must be specified. If f is specified, its value overrides the argument n. For a given argument n, the default value off isk/(n+k), with k the number of new vector observations. This corresponds to a stationnary observation process.
Value
The updated mean vector.
See Also
updateCovariance
Examples
n <- 1e4
n0 <- 5e3
d <- 10
x <- matrix(runif(n*d), n, d)
## Direct computation
xbar1 <- colMeans(x)
## Recursive computation
xbar2 <- colMeans(x[1:n0,])
xbar2 <- updateMean(xbar2, x[(n0+1):n,], n0)
## Check equality
all.equal(xbar1, xbar2)