PairedTTest
✖
PairedTTest
Details and Options



- PairedTTest tests the null hypothesis
against the alternative hypothesis
:
-
data {data1,data2} - where μ is the population mean for data and μ12 is the mean 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.
- PairedTTest[dspec,μ0,"HypothesisTestData"] returns a HypothesisTestData object htd that can be used to extract additional test results and properties using the form htd["property"].
- PairedTTest[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 - PairedTTest is more powerful than the TTest when samples are matched.
- For univariate samples, PairedTTest performs the Student
test for matched pairs. The test statistic is assumed to follow a StudentTDistribution.
- For multivariate samples, PairedTTest performs Hotelling's
test for matched pairs. The test statistic is assumed to follow a HotellingTSquareDistribution.
- The following options can be used:
-
AlternativeHypothesis "Unequal" the inequality for the alternative hypothesis SignificanceLevel 0.05 cutoff for diagnostics and reporting VerifyTestAssumptions Automatic what assumptions to verify - For the PairedTTest, 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. This value
is also used in diagnostic tests of assumptions, including tests for normality, equal variance, and symmetry. By default,
is set to 0.05.
- Named settings for VerifyTestAssumptions in PairedTTest include:
-
"Normality" verify that all data is normally distributed
Examples
open allclose allBasic Examples (3)Summary of the most common use cases
Test whether the mean of a population is zero:

https://wolfram.com/xid/0bc6at4mouuyx7a-g7mcn

https://wolfram.com/xid/0bc6at4mouuyx7a-yfec


https://wolfram.com/xid/0bc6at4mouuyx7a-bbkq82

Test whether the means of two dependent populations differ:

https://wolfram.com/xid/0bc6at4mouuyx7a-lq5ldd

https://wolfram.com/xid/0bc6at4mouuyx7a-soqc9


https://wolfram.com/xid/0bc6at4mouuyx7a-bolh4v

At the 0.05 level, the mean of the differenced data is not significantly different from 0:

https://wolfram.com/xid/0bc6at4mouuyx7a-csendg

Compare the locations of dependent multivariate populations:

https://wolfram.com/xid/0bc6at4mouuyx7a-2lnxj

https://wolfram.com/xid/0bc6at4mouuyx7a-nj57pj


https://wolfram.com/xid/0bc6at4mouuyx7a-b6etdn

At the 0.05 level, the mean of the differenced data is not significantly different from 0:

https://wolfram.com/xid/0bc6at4mouuyx7a-j55r4w

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

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

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

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

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

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

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

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


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


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

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

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

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

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

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

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

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

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

Test whether the mean of differenced datasets is zero:

https://wolfram.com/xid/0bc6at4mouuyx7a-ekpnsf
The -values are generally small when the mean is not zero:

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

The -values are generally large when the mean is zero:

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

Test whether the mean of differenced data is 3:

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

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


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

Test whether the mean vector of differenced multivariate data is the zero vector:

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

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

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

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

Create a HypothesisTestData object for repeated property extraction:

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

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

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

Extract some properties from a HypothesisTestData object:

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

https://wolfram.com/xid/0bc6at4mouuyx7a-bpn9dr
The -value, test statistic, and degrees of freedom:

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


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


https://wolfram.com/xid/0bc6at4mouuyx7a-c7xo2s

Extract any number of properties simultaneously:

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

https://wolfram.com/xid/0bc6at4mouuyx7a-dmu6hk
The -value, test statistic, and degrees of freedom:

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

Reporting (3)

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

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

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

Retrieve the entries from a test table for customized reporting:

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

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

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

Tabulate -values or test statistics:

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

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

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


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


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

The test statistic from the table:

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

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

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

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


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

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

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

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


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


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

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

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

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


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


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

SignificanceLevel (2)
Set the significance level for diagnostic tests:

https://wolfram.com/xid/0bc6at4mouuyx7a-fn2ahc

https://wolfram.com/xid/0bc6at4mouuyx7a-dwfi1


https://wolfram.com/xid/0bc6at4mouuyx7a-cod4ca


The significance level is also used for "TestConclusion" and "ShortTestConclusion":

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

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

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

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


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


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


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

VerifyTestAssumptions (3)
By default, normality is tested:

https://wolfram.com/xid/0bc6at4mouuyx7a-db7e1z

https://wolfram.com/xid/0bc6at4mouuyx7a-dnfybp

The result is the same, but a warning is issued:

https://wolfram.com/xid/0bc6at4mouuyx7a-fx7k7n


Alternatively, use All:

https://wolfram.com/xid/0bc6at4mouuyx7a-djhg9b


Set the normality assumption to True:

https://wolfram.com/xid/0bc6at4mouuyx7a-f03ye

Bypassing diagnostic tests can save compute time:

https://wolfram.com/xid/0bc6at4mouuyx7a-hrliot

https://wolfram.com/xid/0bc6at4mouuyx7a-mmqfh1


https://wolfram.com/xid/0bc6at4mouuyx7a-bglfb1

It is often useful to bypass diagnostic tests for simulation purposes:

https://wolfram.com/xid/0bc6at4mouuyx7a-kfpeh6

https://wolfram.com/xid/0bc6at4mouuyx7a-cxjgtt

The assumptions of the test hold by design, so a great deal of time can be saved:

https://wolfram.com/xid/0bc6at4mouuyx7a-cmfh98


https://wolfram.com/xid/0bc6at4mouuyx7a-btr43n

Applications (1)Sample problems that can be solved with this function
A group of 15 students is convinced that they were more prepared for the mathematics portion of the ACT than that of the SAT. Test this claim assuming that national ACT and SAT scores are normally distributed with means 21.7 and 528.5 and standard deviations 4.1 and 117.2, respectively:

https://wolfram.com/xid/0bc6at4mouuyx7a-ffl9kw

https://wolfram.com/xid/0bc6at4mouuyx7a-k935ra
For comparison, the data should be normalized:

https://wolfram.com/xid/0bc6at4mouuyx7a-ksaw0d
Density estimates for the individual and differenced scores:

https://wolfram.com/xid/0bc6at4mouuyx7a-d8ui3

can be rejected at the 5% level. The students' claim is not refuted:

https://wolfram.com/xid/0bc6at4mouuyx7a-dud2zh

Properties & Relations (6)Properties of the function, and connections to other functions
PairedTTest is equivalent to a TTest for a single dataset:

https://wolfram.com/xid/0bc6at4mouuyx7a-tv5gf

https://wolfram.com/xid/0bc6at4mouuyx7a-cs4lki


https://wolfram.com/xid/0bc6at4mouuyx7a-izj5k0

For two datasets, the PairedTTest is equivalent to a TTest of the paired differences:

https://wolfram.com/xid/0bc6at4mouuyx7a-f2r3wk

https://wolfram.com/xid/0bc6at4mouuyx7a-ilce0f


https://wolfram.com/xid/0bc6at4mouuyx7a-c9a7mg

If the variance of the population is known, the more powerful PairedZTest can be used:

https://wolfram.com/xid/0bc6at4mouuyx7a-de5rmm

https://wolfram.com/xid/0bc6at4mouuyx7a-2aqwh

https://wolfram.com/xid/0bc6at4mouuyx7a-ez3vrg
The probability that the PairedZTest will return a -value smaller than the PairedTTest:

https://wolfram.com/xid/0bc6at4mouuyx7a-eknsou

If the data can be paired, the PairedTTest is more powerful than the TTest:

https://wolfram.com/xid/0bc6at4mouuyx7a-j7yihz
The paired test detects a significant difference where the unpaired test does not:

https://wolfram.com/xid/0bc6at4mouuyx7a-jsty9


https://wolfram.com/xid/0bc6at4mouuyx7a-e5l7f9

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

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

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


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

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

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

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


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

Test the difference of the means of the two paths:

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

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

Possible Issues (1)Common pitfalls and unexpected behavior
PairedTTest requires that the data be normally distributed:

https://wolfram.com/xid/0bc6at4mouuyx7a-gs49tr

https://wolfram.com/xid/0bc6at4mouuyx7a-18i20


Use a median-based test instead:

https://wolfram.com/xid/0bc6at4mouuyx7a-dsqwzr

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

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

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

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

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

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