running_weighted_mean: Running weighted mean

View source: R/means.R

running_weighted_meanR Documentation

Running weighted mean

Description

Computes running weighted mean of a vector or matrix, returning the values from each step.

Usage

running_weighted_mean(x, w, na.rm)

Arguments

x

A numeric vector, matrix, three dimensional array, or an mcmc object from the coda package. For matrix, the mean is computed for each column, and for array the sweep is done over the third dimension.

w

A numeric vector of non-negative weights. Will be automatically normalised to sum to one.

na.rm

If TRUE, NA values in x (and corresponding weights in w) are omitted from the computation. Default is FALSE. Only used in vector methods.

Value

A vector containing the recursive weighted mean estimates.


helske/diagis documentation built on Sept. 9, 2023, 8:15 a.m.