Last data update: 2014.03.03

R: Walsh Averages
walshR Documentation

Walsh Averages

Description

Given a list of n numbers, the Walsh averages are the n(n+1)/2 pairwise averages.

Usage

walsh(x)

Arguments

x

A numeric vector

Value

The Walsh averages.

Author(s)

John Kloke kloke@biostat.wisc.edu

References

Hettmansperger, T.P. and McKean J.W. (2011), Robust Nonparametric Statistical Methods, 2nd ed., New York: Chapman-Hall.

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

See Also

signedrank

Examples


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)
  }

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(Rfit)
Loading required package: quantreg
Loading required package: SparseM

Attaching package: 'SparseM'

The following object is masked from 'package:base':

    backsolve

> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/Rfit/walsh.Rd_%03d_medium.png", width=480, height=480)
> ### Name: walsh
> ### Title: Walsh Averages
> ### Aliases: walsh
> 
> ### ** Examples
> 
> 
> median(walsh(rnorm(100)))  # Hodges-Lehmann estimate of location
[1] -0.2262217
> 
> ## 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)
+   }
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)
}
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>