SignTest
✖
SignTest
Details and Options



- SignTest tests the null hypothesis
against the alternative hypothesis
:
-
data {data1,data2} - where μ is the population median for data and μ12 is the median of the paired differences of the two datasets
.
- By default, a probability value or
-value is returned.
- A small
-value suggests that it is unlikely that
is true.
- The data in dspec can be univariate {x1,x2,…} or multivariate {{x1,y1,…},{x2,y2,…},…}.
- If two samples are given, they must be of equal length.
- The argument μ0 can be a real number or a real vector with length equal to the dimension of the data.
- SignTest[dspec,μ0,"HypothesisTestData"] returns a HypothesisTestData object htd that can be used to extract additional test results and properties using the form htd["property"].
- SignTest[dspec,μ0,"property"] can be used to directly give the value of "property".
- Properties related to the reporting of test results include:
-
"DegreesOfFreedom" the degrees of freedom used in a test "PValue" list of -values
"PValueTable" formatted table of -values
"ShortTestConclusion" a short description of the conclusion of a test "TestConclusion" a description of the conclusion of a test "TestData" list of pairs of test statistics and -values
"TestDataTable" formatted table of -values and test statistics
"TestStatistic" list of test statistics "TestStatisticTable" formatted table of test statistics - For univariate samples, SignTest performs the sign test for medians of paired samples. The test statistic is assumed to follow a BinomialDistribution[n,1/2] where n is the number of elements in dspec not equal to μ0.
- For multivariate samples, SignTest performs an affine invariant test for paired samples using spatial signs. The test statistic is assumed to follow a ChiSquareDistribution[dim] where dim is the dimension of dspec.
- The following options can be used:
-
AlternativeHypothesis "Unequal" the inequality for the alternative hypothesis MaxIterations Automatic max iterations for multivariate median tests Method Automatic the method to use for computing -values
SignificanceLevel 0.05 cutoff for diagnostics and reporting - For the SignTest, a cutoff
is chosen such that
is rejected only if
. The value of
used for the "TestConclusion" and "ShortTestConclusion" properties is controlled by the SignificanceLevel option. By default,
is set to 0.05.
Examples
open allclose allBasic Examples (4)Summary of the most common use cases
Test whether the median of a population is zero:

https://wolfram.com/xid/0enwmqlye-bcn0x0

https://wolfram.com/xid/0enwmqlye-brgvwg

Test whether the spatial median of a multivariate population is some value:

https://wolfram.com/xid/0enwmqlye-etsac

https://wolfram.com/xid/0enwmqlye-cgw1ht


https://wolfram.com/xid/0enwmqlye-j03gr3

Compare the median difference for paired data to a particular value:

https://wolfram.com/xid/0enwmqlye-dum1jr

https://wolfram.com/xid/0enwmqlye-c3rena

Report the test results in a table:

https://wolfram.com/xid/0enwmqlye-otjzsa

Create a HypothesisTestData object for repeated property extraction:

https://wolfram.com/xid/0enwmqlye-crwuz3

https://wolfram.com/xid/0enwmqlye-jwsqlx

A list of available properties:

https://wolfram.com/xid/0enwmqlye-hi2110

Extract a single property or a list of properties:

https://wolfram.com/xid/0enwmqlye-cad9bv


https://wolfram.com/xid/0enwmqlye-b6k7bw

Scope (13)Survey of the scope of standard use cases
Testing (10)

https://wolfram.com/xid/0enwmqlye-mk1rwj
The -values are typically large when the median is close to μ0:

https://wolfram.com/xid/0enwmqlye-dcnktx

The -values are typically small when the location is far from μ0:

https://wolfram.com/xid/0enwmqlye-b15esj

Using Automatic is equivalent to testing for a median of zero:

https://wolfram.com/xid/0enwmqlye-bbn60w

https://wolfram.com/xid/0enwmqlye-cv9w6t


https://wolfram.com/xid/0enwmqlye-nloyf


https://wolfram.com/xid/0enwmqlye-ccr6o1
The -values are typically large when the median is close to μ0:

https://wolfram.com/xid/0enwmqlye-fk03hb

The -values are typically small when the location is far from μ0:

https://wolfram.com/xid/0enwmqlye-e810zu

Test whether the median vector of a multivariate population is the zero vector:

https://wolfram.com/xid/0enwmqlye-bqd543

https://wolfram.com/xid/0enwmqlye-hr2vr

Alternatively, test against {0.1,0,-0.05,0}:

https://wolfram.com/xid/0enwmqlye-cze22


https://wolfram.com/xid/0enwmqlye-ekpnsf
The -values are generally small when the locations are not equal:

https://wolfram.com/xid/0enwmqlye-bud71n

The -values are generally large when the locations are equal:

https://wolfram.com/xid/0enwmqlye-nnksx4


https://wolfram.com/xid/0enwmqlye-exhx0q
The order of the datasets affects the test results:

https://wolfram.com/xid/0enwmqlye-f3e5kf


https://wolfram.com/xid/0enwmqlye-jqamzo

Test whether the median difference vector of two multivariate populations is the zero vector:

https://wolfram.com/xid/0enwmqlye-cbbn53

https://wolfram.com/xid/0enwmqlye-fnaxqn

https://wolfram.com/xid/0enwmqlye-f9ns4d

Alternatively, test against {1,0,-1,0}:

https://wolfram.com/xid/0enwmqlye-hkcfuq

Create a HypothesisTestData object for repeated property extraction:

https://wolfram.com/xid/0enwmqlye-0x5m5

https://wolfram.com/xid/0enwmqlye-cc8eh1
The properties available for extraction:

https://wolfram.com/xid/0enwmqlye-frvg20

Extract some properties from a HypothesisTestData object:

https://wolfram.com/xid/0enwmqlye-c03go

https://wolfram.com/xid/0enwmqlye-bpn9dr
The -value and test statistic:

https://wolfram.com/xid/0enwmqlye-365dq


https://wolfram.com/xid/0enwmqlye-bn5rjv

Extract any number of properties simultaneously:

https://wolfram.com/xid/0enwmqlye-bycagv

https://wolfram.com/xid/0enwmqlye-dmu6hk
The -value and test statistic:

https://wolfram.com/xid/0enwmqlye-i6fwj7

Reporting (3)

https://wolfram.com/xid/0enwmqlye-ba6zb1

https://wolfram.com/xid/0enwmqlye-hb1mu5

https://wolfram.com/xid/0enwmqlye-hh3kq

Retrieve the entries from a test table for customized reporting:

https://wolfram.com/xid/0enwmqlye-cg07e5

https://wolfram.com/xid/0enwmqlye-98x7a

https://wolfram.com/xid/0enwmqlye-fforak

Tabulate -values or test statistics:

https://wolfram.com/xid/0enwmqlye-fr3ezf

https://wolfram.com/xid/0enwmqlye-blo8x

https://wolfram.com/xid/0enwmqlye-g8i1dt


https://wolfram.com/xid/0enwmqlye-o0wuj


https://wolfram.com/xid/0enwmqlye-dw7vzl

The test statistic from the table:

https://wolfram.com/xid/0enwmqlye-bitsqd

Options (9)Common values & functionality for each option
AlternativeHypothesis (3)
A two-sided test is performed by default:

https://wolfram.com/xid/0enwmqlye-bgoxnx

https://wolfram.com/xid/0enwmqlye-he0w0s


https://wolfram.com/xid/0enwmqlye-jqt2u8

Perform a two-sided test or a one-sided alternative:

https://wolfram.com/xid/0enwmqlye-kwmm8d

https://wolfram.com/xid/0enwmqlye-dy0fuc


https://wolfram.com/xid/0enwmqlye-g8h639


https://wolfram.com/xid/0enwmqlye-f19ykz

Perform tests with one-sided alternatives when μ0 is given:

https://wolfram.com/xid/0enwmqlye-cay5xk

https://wolfram.com/xid/0enwmqlye-v01gr


https://wolfram.com/xid/0enwmqlye-ci67wa


https://wolfram.com/xid/0enwmqlye-m3sbc

MaxIterations (2)
Set the maximum number of iterations to use for multivariate tests:

https://wolfram.com/xid/0enwmqlye-wsdxy
By default, 500 iterations are allowed:

https://wolfram.com/xid/0enwmqlye-l6esri


https://wolfram.com/xid/0enwmqlye-eb62z0

Setting the maximum number of iterations may result in lack of convergence:

https://wolfram.com/xid/0enwmqlye-z0x96
The -values are not equivalent:

https://wolfram.com/xid/0enwmqlye-hu3jt7



https://wolfram.com/xid/0enwmqlye-xar3i

Method (3)
By default, -values are computed using the BinomialDistribution for univariate data:

https://wolfram.com/xid/0enwmqlye-v21sy

https://wolfram.com/xid/0enwmqlye-fifdab


https://wolfram.com/xid/0enwmqlye-b9g9ag

Asymptotic methods can be used for univariate data:

https://wolfram.com/xid/0enwmqlye-hy6ohx

https://wolfram.com/xid/0enwmqlye-f69ts


https://wolfram.com/xid/0enwmqlye-drrw70

For multivariate data, only the asymptotic result is available:

https://wolfram.com/xid/0enwmqlye-b21vkx

https://wolfram.com/xid/0enwmqlye-xj27d


https://wolfram.com/xid/0enwmqlye-cwvw4

SignificanceLevel (1)
The significance level is also used for "TestConclusion" and "ShortTestConclusion":

https://wolfram.com/xid/0enwmqlye-bhkod7

https://wolfram.com/xid/0enwmqlye-lasldz

https://wolfram.com/xid/0enwmqlye-hykroc

https://wolfram.com/xid/0enwmqlye-bvt7nt


https://wolfram.com/xid/0enwmqlye-hpqqgh


https://wolfram.com/xid/0enwmqlye-flavjg


https://wolfram.com/xid/0enwmqlye-m2oyg2

Applications (2)Sample problems that can be solved with this function
A new sleeping aid was tested on eight patients. The number of minutes taken for each subject to fall asleep was recorded for a night taking the medication and for a night with a placebo:

https://wolfram.com/xid/0enwmqlye-d2f0zn

https://wolfram.com/xid/0enwmqlye-zrbrs

The SignTest does not detect a difference in the sleep aid and placebo:

https://wolfram.com/xid/0enwmqlye-zgac

The datasets, while very small, do not fail a test for normality:

https://wolfram.com/xid/0enwmqlye-bszeq9

A more powerful PairedTTest shows a significant reduction in time to sleep with the sleep aid:

https://wolfram.com/xid/0enwmqlye-dva4k

A group of 10 students with low assessments in mathematics and science was asked to participate in tutoring program. A test similar to the original assessment was administered after the program. The students' scores on the math and science portions of both assessments are as follows:

https://wolfram.com/xid/0enwmqlye-bpvtuq

https://wolfram.com/xid/0enwmqlye-bs111p

https://wolfram.com/xid/0enwmqlye-nxajtb

There is a significant improvement in scores overall:

https://wolfram.com/xid/0enwmqlye-c1ru7a

The Bonferroni-corrected tests of the individual components suggest that math scores alone account for the detected improvement:

https://wolfram.com/xid/0enwmqlye-em7p9w

https://wolfram.com/xid/0enwmqlye-frjnr9


https://wolfram.com/xid/0enwmqlye-ki65yt

Properties & Relations (6)Properties of the function, and connections to other functions
Conceptually, the SignTest counts the number of positive signs in a dataset:

https://wolfram.com/xid/0enwmqlye-dhszi9

https://wolfram.com/xid/0enwmqlye-mv1i75

https://wolfram.com/xid/0enwmqlye-b58j9i

https://wolfram.com/xid/0enwmqlye-gbu3q8

For univariate data, the test statistic follows a BinomialDistribution, ignoring zeros:

https://wolfram.com/xid/0enwmqlye-ecw34

https://wolfram.com/xid/0enwmqlye-eogj


https://wolfram.com/xid/0enwmqlye-7teuu

The SignTest is generally less powerful than other hypothesis tests for location:

https://wolfram.com/xid/0enwmqlye-l487ko

https://wolfram.com/xid/0enwmqlye-e4yza

https://wolfram.com/xid/0enwmqlye-iykx13


https://wolfram.com/xid/0enwmqlye-gahra


https://wolfram.com/xid/0enwmqlye-05hmt

For multivariate data, spatial signs are used when computing the test statistic:

https://wolfram.com/xid/0enwmqlye-iwe5v

https://wolfram.com/xid/0enwmqlye-j2dthq
Spatial signs tend to cluster when the spatial median is nonzero:

https://wolfram.com/xid/0enwmqlye-bxzy6

The amount of clustering is quantified by the test statistic:

https://wolfram.com/xid/0enwmqlye-3w8ek


https://wolfram.com/xid/0enwmqlye-do94ni

The test statistic follows a ChiSquareDistribution[p]:

https://wolfram.com/xid/0enwmqlye-38ivn


https://wolfram.com/xid/0enwmqlye-ff80um


https://wolfram.com/xid/0enwmqlye-jvazn

The test statistic is affine invariant for multivariate data:

https://wolfram.com/xid/0enwmqlye-gu9uw4

https://wolfram.com/xid/0enwmqlye-8xxnw

https://wolfram.com/xid/0enwmqlye-dqfr71


https://wolfram.com/xid/0enwmqlye-lwz8r7

The sign test works with the values only when the input is a TimeSeries:

https://wolfram.com/xid/0enwmqlye-7py5sj

https://wolfram.com/xid/0enwmqlye-57bf57


https://wolfram.com/xid/0enwmqlye-vvd88

The sign test works with all the values together when the input is a TemporalData:

https://wolfram.com/xid/0enwmqlye-qry3ls

https://wolfram.com/xid/0enwmqlye-b1l4g0


https://wolfram.com/xid/0enwmqlye-t6toez

Test the difference of the medians of the two paths:

https://wolfram.com/xid/0enwmqlye-kxzwhd

https://wolfram.com/xid/0enwmqlye-jdvl55

Neat Examples (2)Surprising or curious use cases
Compute the statistic when the null hypothesis is true:

https://wolfram.com/xid/0enwmqlye-2qqg3c

https://wolfram.com/xid/0enwmqlye-ywy3ty
The test statistic given a particular alternative:

https://wolfram.com/xid/0enwmqlye-c5cy2n
Compare the distributions of the test statistics:

https://wolfram.com/xid/0enwmqlye-87eb6q

The distribution of spatial signs in three dimensions shows that larger deviations from a zero mean vector produce more highly clustered spatial signs and larger sign statistics:

https://wolfram.com/xid/0enwmqlye-clce4j

https://wolfram.com/xid/0enwmqlye-ezx1n

https://wolfram.com/xid/0enwmqlye-e98rvq

https://wolfram.com/xid/0enwmqlye-s842b

Wolfram Research (2010), SignTest, Wolfram Language function, https://reference.wolfram.com/language/ref/SignTest.html.
Text
Wolfram Research (2010), SignTest, Wolfram Language function, https://reference.wolfram.com/language/ref/SignTest.html.
Wolfram Research (2010), SignTest, Wolfram Language function, https://reference.wolfram.com/language/ref/SignTest.html.
CMS
Wolfram Language. 2010. "SignTest." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/SignTest.html.
Wolfram Language. 2010. "SignTest." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/SignTest.html.
APA
Wolfram Language. (2010). SignTest. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SignTest.html
Wolfram Language. (2010). SignTest. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SignTest.html
BibTeX
@misc{reference.wolfram_2025_signtest, author="Wolfram Research", title="{SignTest}", year="2010", howpublished="\url{https://reference.wolfram.com/language/ref/SignTest.html}", note=[Accessed: 29-March-2025
]}
BibLaTeX
@online{reference.wolfram_2025_signtest, organization={Wolfram Research}, title={SignTest}, year={2010}, url={https://reference.wolfram.com/language/ref/SignTest.html}, note=[Accessed: 29-March-2025
]}