is an option for hypothesis testing functions like LocationTest that specifies the alternative hypothesis.
AlternativeHypothesis
is an option for hypothesis testing functions like LocationTest that specifies the alternative hypothesis.
Details
- For a hypothesis test with test statistic
, AlternativeHypothesis can be used to test the null hypothesis
against particular alternatives
. - Typical settings include:
-
"Unequal"
and

"Less"
and

"Greater"
and

- For functions using AlternativeHypothesis, a two-sided test is performed by default.
Examples
open all close allBasic Examples (2)
Perform a two-sided test for location:
data = RandomVariate[NormalDistribution[], 100];LocationTest[data, AlternativeHypothesis -> "Unequal"]The setting "Unequal" is chosen by default:
LocationTest[data]Perform one of the two one-sided alternatives:
data = RandomVariate[NormalDistribution[], 100];LocationTest[data, AlternativeHypothesis -> "Less"]LocationTest[data, AlternativeHypothesis -> "Greater"]Properties & Relations (3)
The
-value from a two-sided test is twice the smaller one-sided
-value:
data = RandomVariate[NormalDistribution[], 100];ptwo = LocationTest[data, AlternativeHypothesis -> "Unequal"]pone = Min[LocationTest[data, AlternativeHypothesis -> "Less"], LocationTest[data, AlternativeHypothesis -> "Greater"]]ptwo / poneThe interpretation of a two-sided test:
data = RandomVariate[NormalDistribution[1, 1], 15];ℋ = LocationTest[data, 1.3, "HypothesisTestData", AlternativeHypothesis -> "Unequal"];𝒟 = StudentTDistribution[14];T = ℋ["TestStatistic", "T"]twosided = Show[Plot[PDF[𝒟, x], {x, -5, -Abs[T]}, Filling -> Axis], Plot[PDF[𝒟, x], {x, Abs[T], 5}, Filling -> Axis], PlotRange -> {{-5, 5}, All}];Show[Plot[PDF[𝒟, x], {x, -5, 5}], twosided]The
-value can be interpreted as an area under the distribution of the test statistic:
(Integrate[PDF[𝒟, x], {x, -Infinity, -Abs[T]}] + Integrate[PDF[𝒟, x], {x, Abs[T], Infinity}])ℋ["T"]Interpretation of both one-sided alternatives:
data = RandomVariate[NormalDistribution[1, 1], 15];Subscript[ℋ, L] = LocationTest[data, 1.3, "HypothesisTestData", AlternativeHypothesis -> "Less"];
Subscript[ℋ, G] = LocationTest[data, 1.3, "HypothesisTestData", AlternativeHypothesis -> "Greater"];𝒟 = StudentTDistribution[14];T = Subscript[ℋ, L]["TestStatistic", "T"]less = Plot[PDF[𝒟, x], {x, -5, T}, Filling -> Axis, PlotRange -> {{-5, 5}, All}];greater = Plot[PDF[𝒟, x], {x, T, 5}, Filling -> Axis, PlotRange -> {{-5, 5}, All}];{Show[Plot[PDF[𝒟, x], {x, -5, 5}], less, PlotLabel -> "Less"], Show[Plot[PDF[𝒟, x], {x, -5, 5}], greater, PlotLabel -> "Greater"]}The areas are equivalent to the
-values returned by the test:
{Integrate[PDF[𝒟, x], {x, -Infinity, T}], Subscript[ℋ, L]["T"]}{Integrate[PDF[𝒟, x], {x, T, Infinity}], Subscript[ℋ, G]["T"]}See Also
Related Guides
History
Text
Wolfram Research (2010), AlternativeHypothesis, Wolfram Language function, https://reference.wolfram.com/language/ref/AlternativeHypothesis.html.
CMS
Wolfram Language. 2010. "AlternativeHypothesis." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/AlternativeHypothesis.html.
APA
Wolfram Language. (2010). AlternativeHypothesis. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/AlternativeHypothesis.html
BibTeX
@misc{reference.wolfram_2026_alternativehypothesis, author="Wolfram Research", title="{AlternativeHypothesis}", year="2010", howpublished="\url{https://reference.wolfram.com/language/ref/AlternativeHypothesis.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_alternativehypothesis, organization={Wolfram Research}, title={AlternativeHypothesis}, year={2010}, url={https://reference.wolfram.com/language/ref/AlternativeHypothesis.html}, note=[Accessed: 12-June-2026]}