This function will test a hypothesis based on the sign test and reports
linearly interpolated confidence intervals for one sample problems.
Usage
SIGN.test(x, y = NULL, md = 0, alternative = "two.sided", conf.level = 0.95)
Arguments
x
numeric vector; NAs and Infs are allowed but will be removed.
y
optional numeric vector; NAs and Infs are allowed but will be removed.
md
a single number representing the value of the population median specified
by the null hypothesis
alternative
is a character string, one of "greater",
"less", or "two.sided", or the initial letter of each,
indicating the specification of the alternative hypothesis. For
one-sample tests, alternative refers to the true
median of the parent population in relation to the hypothesized
value of the median.
conf.level
confidence level for the returned confidence
interval, restricted to lie between zero and one
Details
Computes a “Dependent-samples Sign-Test” if both
x and y are provided. If only x is provided,
computes the “Sign-Test”.
Value
A list of class htest, containing the following components:
statistic
the S-statistic (the number of positive differences
between the data and the hypothesized median), with names attribute
“S”.
p.value
the p-value for the test
conf.int
is a confidence interval (vector of length 2) for the true
median based on linear interpolation. The confidence level is recorded in
the attribute conf.level. When the alternative is not
"two.sided", the confidence interval will be half-infinite,
to reflect the interpretation of a confidence interval as the set of
all values k for which one would not reject the null hypothesis
that the true mean or difference in means is k. Here infinity
will be represented by Inf.
estimate
is avector of length 1, giving the sample median;
this estimates the corresponding population parameter. Component
estimate has a names attribute describing its elements.
null.value
is the value of the median specified by the null hypothesis. This
equals the input argument md. Component null.value has a names
attribute describing its elements.
alternative
records the value of the input argument alternative:
"greater", "less", or "two.sided"
data.name
a character string (vector of length 1) containing the actual
name of the input vector x
Null Hypothesis
For the one-sample sign-test, the null hypothesis is
that the median of the population from which x is drawn is md.
For the two-sample dependent case, the null hypothesis is
that the median for the differences of the populations from which x
and y are drawn is md.
The alternative hypothesis indicates the direction of divergence of the
population median for x from md (i.e., "greater",
"less", "two.sided".)
Assumptions
The median test assumes the parent population is continuous.
Confidence Interval
A linear interpolation is returned for the related
confidence interval (returned component conf.int) which can be obtained by
interpolating between the possible achieved confidence levels closest to the
desired level. Note that, as explained under the description of
conf.int, the confidence interval will be half-infinite when alternative
is not "two.sided"; infinity will be represented by Inf.
Note
The reported confidence interval is based on
linear interpolation. The lower and upper confidence levels
are exact.
Author(s)
Alan T. Arnholt
References
Gibbons, J.D. and Chakraborti, S. (1992).
Nonparametric Statistical Inference. Marcel Dekker Inc., New York.
Kitchens, L.J.(2003). Basic Statistics and Data Analysis. Duxbury.
Conover, W. J. (1980). Practical Nonparametric Statistics, 2nd ed. Wiley, New York.
Lehmann, E. L. (1975). Nonparametrics: Statistical Methods Based on Ranks. Holden and Day, San Francisco.
See Also
z.test, zsum.test, tsum.test
Examples
with(data = Phone,
SIGN.test(call.time,md=2.1))
# Example 10.1 from PASWR.
# Computes two-sided sign-test for the null hypothesis
# that the population median is 2.1. The alternative
# hypothesis is that the median is not 2.1. An interpolated
# upper 95% upper bound for the population median will be computed.
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(PASWR)
Loading required package: e1071
Loading required package: MASS
Loading required package: lattice
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/PASWR/SIGN.test.Rd_%03d_medium.png", width=480, height=480)
> ### Name: SIGN.test
> ### Title: Sign Test
> ### Aliases: SIGN.test
> ### Keywords: htest
>
> ### ** Examples
>
> with(data = Phone,
+ SIGN.test(call.time,md=2.1))
One-sample Sign-Test
data: call.time
s = 11, p-value = 1
alternative hypothesis: true median is not equal to 2.1
95 percent confidence interval:
0.7261939 5.4952244
sample estimates:
median of x
2.1
Conf.Level L.E.pt U.E.pt
Lower Achieved CI 0.9069 0.8000 5.2000
Interpolated CI 0.9500 0.7262 5.4952
Upper Achieved CI 0.9653 0.7000 5.6000
> # Example 10.1 from PASWR.
> # Computes two-sided sign-test for the null hypothesis
> # that the population median is 2.1. The alternative
> # hypothesis is that the median is not 2.1. An interpolated
> # upper 95% upper bound for the population median will be computed.
>
>
>
>
>
> dev.off()
null device
1
>