View source: R/medianHL.circular.R
medianHL.circular | R Documentation |
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.
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,...)
x |
a vector. For the function |
na.rm |
logical, indicating if |
method |
The method used to calculate the median, see details below. |
prop |
The proportion of pairs that are sampled. If |
... |
further arguments passed to the next method. |
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.
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.
Claudio Agostinelli and Alessandro Gagliardi.
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).
mean.circular
, median.circular
.
# 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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.