meanbp: Moving average (weighted) per iteration

View source: R/meanbp.R

meanbpR Documentation

Moving average (weighted) per iteration

Description

Moving average (weighted) per iteration

Usage

meanbp(vector, it = 1000, na.rm = T)

Arguments

vector

: a vector

it

: numbre of iterations

na.rm

: for ignore missing values

Value

This function returns an average whose values are weighted according to the distance that separates them from the median initially, and then, at each cycle, with respect to the "average" calculated in the previous cycle.

Examples

x <- rnorm(100,20,5) # simulate a sample of a population with an average of 20%.
meanbp(x,100) # 100 because the calculation will only be repeated a maximum of 100 times.
#if we compare with mean(x) or median(x):
# we see that meanbp gives a result closer to the true average which is 20

Antoine-Masse/KefiR documentation built on July 4, 2024, 11:40 a.m.