R: Median using Hodges-Lehmann estimate.

medianHL.circular {circular} | R Documentation

## Median using Hodges-Lehmann estimate.

### Description

Sample median for a vector of data using Hodges-Lehmann estimate and Sample median direction measure for a vector of circular data using Hodges-Lehmann estimate.

### Usage

    medianHL(x, na.rm=FALSE, ...)
    ## Default S3 method:
    medianHL(x, na.rm=FALSE,
           method=c("HL1","HL2","HL3"), prop=NULL)
    ## S3 method for class 'circular'
    medianHL(x, na.rm=FALSE,
           method=c("HL1","HL2","HL3"), prop=NULL)

### Arguments

`x` | a vector. For the function `medianHL.circular` the object is coerced to class `circular`.
`na.rm` | logical, indicating if `NA`'s should be omitted.
`method` | The method used to calculate the median, see details below.
`prop` | The proportion of pairs that are sampled. If `NULL` all combinations are used. It must be a number in the interval (0,1) or `NULL`.
`...` | further arguments passed to the next method.

### Details

The algorithm is as follows:

The algorithm will create pairs of elements of the vector `x`.

It will calculate the circular mean on those pairs.

It will calculate the circular median on these averages.

The type of pairs considered are controlled by `method`:

if `method` is "HL1" are considered unordered pairs without replications and repetition in the number of `(n*(n-1))/2` pairs;

if `method` is "HL2" are considered unordered pairs without replications in the number of `(n*(n+1))/2` pairs;

if `method` is "HL3" all pairs are considered in the number of `n^2`.

If `prop` is not `NULL`, the algorithm will consider a subsample following the rules specified by `method`, however, the number of pairs considered is prop * (number of pairs defined by `method`).

For more details see Bennett Sango Otieno, 'An Alternative Estimate of Preferred Direction for Circular Data', Virginia Tech (2002) pag. 27-28 and 46-47.

### Value

For `medianHL.circular` the median is returned as an object of class `circular` with the attribute given by those of `x`. An attributes `medians` reports all the averages which are minimizer of the circular median function.

### Author(s)

Claudio Agostinelli and Alessandro Gagliardi.

### References

Bennett Sango Otieno, An Alternative Estimate of Preferred Direction for Circular Data, Virginia Tech (July 2002).

Bennett Sango Otieno and Christine M. Anderson-Cook,Measures of preferred direction for environmental and ecological circular data, Springer (June 2004).

### See Also

`mean.circular`, `median.circular`.

### Examples

    # Compute the median direction of a random sample of observations.
      x <- circular(runif(50, circular(0), pi))
    # Calculate the three medians for each method without \code{prop} argument.
      medianHL.circular(x,method="HL1")
      medianHL.circular(x,method="HL2")
      medianHL.circular(x,method="HL3")

[Package circular version 0.4-93 Index]