signmedian.test: Perform Exact Sign Test and Asymptotic Sign Test in Large...

Description Usage Arguments Details Value Note Author(s) References Examples

Description

Perform sign test on one-sample data, which is one of the oldest non-parametric statistical methods. Assume that X comes from a continuous distribution with median = v ( unknown ). Test the null hypothesis H0: median of X v = mu ( mu is the location parameter and is given in the test ) v.s. the alternative hypothesis H1: v > mu ( or v < mu or v != mu ) and calculate the p-value. When the sample size is large, perform the asymptotic sign test. In both ways, calculate the R-estimate of location of X and the distribution free confidence interval for mu.

Usage

1
2
3
4
## S3 method for class 'test'
signmedian(x,mu=0,
alternative=c("two.sided","less","greater"), 
conf.level=0.95,exact=TRUE, ...)

Arguments

x

numeric vector of data values.

mu

the location parameter, it is a number specifying an optional parameter used to form the null hypothesis.

alternative

a character string specifying the alternative hypothesis, must be one of "two.sided" , "greater" or "less". You can specify just the initial letter.

conf.level

confidence level of the confidence interval.

exact

a logical indicating whether an exact p-value should be computed.

...

further arguments to be passed to or from methods.

Details

This is a simple non-parametric statistical method. Perform simple sign test on one-sample data like wilcox.test without ranking. Assume that X comes from a continuous distribution with median = v ( unknown ). Test the null hypothesis H0: median of X v = mu ( mu is given in the test ) v.s. the alternative hypothesis H1: v > mu ( or v < mu or v != mu ) and calculate the p-value. When the sample size is large, perform the asymptotic sign test( with continuity correction ). In both exact and asymptotic sign tests, calculate the R-estimate of location of X and the distribution free confidence interval for location parameter mu. This can also perform a test of the paired data ( X, Y ) if we redefine X with Y-X.

Value

statistic

the value of the test statistic with a name describing it.

parameter

the location parameter mu.

p.value

the p-value for the test.

alternative

a character string describing the alternative hypothesis.

conf.int

a confidence interval for the location parameter.

estimate

an estimate of the location parameter.

method

the type of test applied.

data.name

a character string giving the names of the data.

Note

If you want to perform a test of the paired data ( X, Y ), please redefine X with Y-X and then perform the test.

Author(s)

Ting Yang and Yeyun Yu

References

none.

Examples

1
2
3
4
5
6
7
8
9
##One-sample test
x<-c(-5,-3,-2,1,5,6,3,9,10,15,20,21)
signmedian.test(x,alternative = "greater",exact=TRUE)
signmedian.test(x,mu=3,alternative="two.sided",exact=FALSE)
##Two-sample test(paired data)
x<-c(-5,-3,-2,1,5,6,3,9,10,15,20,21)
y<-c(-1,-2,-3,1,2,3,4,2,6,8,9,10)
x<-y-x
signmedian.test(x,alternative = "greater",exact=TRUE)

Example output

	Exact sign test

data:  x
#(x>0) = 9, mu = 0, p-value = 0.073
alternative hypothesis: the median of x is greater than mu
96.14258 percent confidence interval:
 -2 15
sample estimates:
point estimator 
            5.5 


	Asymptotic sign test(with continuity correction)

data:  x
#(x!=3) = 11, mu = 3, p-value = 0.5465
alternative hypothesis: the median of x is not equal to mu
94.79071 percent confidence interval:
 -3 20
sample estimates:
point estimator 
            5.5 


	Exact sign test

data:  x
#(x>0) = 3, mu = 0, p-value = 0.9673
alternative hypothesis: the median of x is greater than mu
93.45703 percent confidence interval:
 -7  1
sample estimates:
point estimator 
             -3 

signmedian.test documentation built on May 1, 2019, 9:13 p.m.