Description Usage Arguments Details Value References Examples
hl1_test
performs a twosample location test based on
the difference of the onesample HodgesLehmann estimators of both samples.
1 2 3 4 5 6 7 8 9 10 11 12 13 
x 
a (nonempty) numeric vector of data values. 
y 
a (nonempty) numeric vector of data values. 
alternative 
a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater", or "less". 
delta 
a numeric value indicating the true difference in the location or
scale parameter, depending on whether the test should be performed
for a difference in location or in scale. The default is

method 
a character string specifying how the pvalue is computed with
possible values 
scale 
a character string specifying the scale estimator used for standardization
of the test statistic; must be one of 
n.rep 
an integer value specifying the number of random splits used to
calculate the randomization distribution if 
na.rm 
a logical value indicating whether NA values in 
var.test 
a logical value to specify if the samples should be compared
for a difference in scale. The default is 
wobble 
a logical value indicating whether the sample should be checked for
duplicated values that can cause the scale estimate to be zero.
If such values are present, uniform noise is added to the sample,
see 
wobble.seed 
an integer value used as a seed for the random number
generation in case of 
The test statistic for this test is based on the difference of the
onesample HodgesLehmann estimators of x
and y
, see
hodges_lehmann
. Three versions
of the test are implemented: randomization, permutation, and asymptotic.
The test statistic for the permutation and randomization version of the test is standardized using a robust scale estimator, see \insertCiteFriDeh11roburobnptests.
With scale = "S1"
, the scale is estimated by
S = med(x_i  x_j: 1 ≤ i < j ≤ m, y_i  y_j, 1 ≤ i < j ≤ n),
whereas scale = "S2"
uses
S = med(z_i  z_j: 1 ≤ i < j ≤ m + n).
Here, z = (z_1, ..., z_{m + n}) = (x_1  med(x), ..., x_m  med(x), y_1  med(y), ..., y_n  med(y)) is the mediancorrected sample.
The randomization distribution is based on randomly drawn splits with
replacement. The function permp
\insertCitePhiSmy10permrobnptests
is used to calculate the pvalue. For the asymptotic test, a transformed version
of the difference of the HL1estimators, which asymptotically follows a
normal distribution, is used. For more details on the asymptotic test, see
\insertCiteFriDeh11robu;textualrobnptests.
For var.test = TRUE
, the test compares the two samples for a difference
in scale. This is achieved by logtransforming the original squared observations,
i.e. x
is replaced by log(x^2)
and y
by log(y^2)
.
A potential scale difference then appears as a location difference between
the transformed samples, see \insertCiteFri12onli;textualrobnptests.
The sample should not contain zeros to prevent problems with the necessary
logtransformation. If it contains zeros, uniform noise is added to all
variables in order to remove zeros and message is printed.
If the sample has been modified (either because of zeros if var.test = TRUE
or wobble = TRUE
), the modified samples can be retrieved using
set.seed(wobble.seed); wobble(x, y)
.
Both samples need to contain at least 5 nonmissing values.
A named list with class "htest
" containing the following components:
statistic 
the value of the test statistic. 
p.value 
the pvalue for the test. 
estimate 
the onesample HodgesLehmann estimates of 
null.value 
the specified hypothesized value of the mean difference/squared scale ratio. 
alternative 
a character string describing the alternative hypothesis. 
method 
a character string indicating how the pvalue was computed. 
data.name 
a character string giving the names of the data. 
PhiSmy10permrobnptests
\insertRefFriDeh11roburobnptests
\insertRefFri12onlirobnptests
1 2 3 4 5 6 7 8 9 10 11 12 13 14  # Generate random samples
set.seed(108)
x < rnorm(20); y < rnorm(20)
# Asymptotic HL1 test
hl1_test(x, y, method = "asymptotic", scale = "S1")
## Not run:
# HL12 test using randomization principle by drawing 1000 random permutations
# with replacement
hl1_test(x, y, method = "randomization", n.rep = 1000, scale = "S2")
## End(Not run)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.