Learn R Programming

Rfit (version 0.09)

walsh: Walsh Averages

Description

Given a list of n numbers, the Walsh averages are the $latex$ pairwise averages.

Usage

walsh(x)

Arguments

x
A numeric vector

Value

  • The Walsh averages.

References

Hettmansperger, T.P. and McKean J.W. (1998), Robust Nonparametric Statistical Methods, London: Arnold.

Hollander, M. and Wolfe, D.A. (1999), Nonparametric Statistical Methods, New York: Wiley.

See Also

signedrank

Examples

Run this code
median(walsh(rnorm(100)))  # Hodges-Lehmann estimate of location

## The function is currently defined as
function (x) 
{
    n <- length(x)
    w <- vector(n * (n + 1)/2, mode = "numeric")
    ind <- 0
    for (i in 1:n) {
        for (j in i:n) {
            ind <- ind + 1
            w[ind] <- 0.5 * (x[i] + x[j])
        }
    }
    return(w)
  }

Run the code above in your browser using DataLab