New in Wolfram
Mathematica
8: Parameter Estimation and Testing
◄
previous
|
next
►
Core Algorithms
Use General Hypothesis Test Functions to Automatically Select Tests
LocationTest
automates the process of testing assumptions and picking tests of location. Here it performs a
-test under a particular one-sided alternative.
In[1]:=
X
d1 = NormalDistribution[-.5, 1]; d2 = NormalDistribution[1.5, 1]; data = BlockRandom[SeedRandom[6]; RandomVariate[d2, 100]];
In[2]:=
X
Show[Plot[{PDF[d1, x], PDF[d2, x]}, {x, -6, 7}, PlotStyle -> {{Thick, Darker[Green]}, {Thick, Darker[Red]}}, Axes -> {True, False}, Ticks -> None, PlotLabel -> Text[Style[ "\!\(\*SubscriptBox[\(H\), \(o\)]\): t \[LessEqual] \ \!\(\*SubscriptBox[\(t\), \(o\)]\)" , Bold, FontSize -> 14]]], Plot[PDF[d1, x], {x, 1.5, 7}, PlotRange -> All, Filling -> Axis], Graphics[{Dashed, Red, Line[{{1.5, 0}, {1.5, PDF[d2, 1.5]}}]}], Graphics[{Dashed, Green, Line[{{-.5, 0}, {-.5, PDF[d1, -.5]}}]}], Graphics[{Arrowheads[Small], Arrow[{{4., 0.1}, {1.9, 0.015}}], Text[ Style["\!\(\*SubscriptBox[\(P\), SubscriptBox[\(H\), \(o\)]]\)[ t \ > \!\(\*SubscriptBox[\(t\), \(obs\)]\) ]", Bold, FontSize -> 12], {4, 0.1}, {-1, -1}]}], Graphics[{Arrowheads[Small], Arrow[{{-1.5, 0.1}, {-.5, 0.1}}], Text[ Style["\!\(\*SubscriptBox[\(t\), \(o\)]\)", Bold, FontSize -> 12], {-1.9, 0.09}, {-1, -1}]}], Graphics[{Arrowheads[Small], Arrow[{{3., 0.25}, {1.5, 0.25}}], Text[ Style["\!\(\*SubscriptBox[\(t\), \(obs\)]\)", Bold, FontSize -> 12], {3.25, 0.24}, {-1, -1}]}], ImageSize -> 300]
Out[2]=
In[3]:=
X
Subscript[\[Mu], 0] = 1.4; LocationTest[data, Subscript[\[Mu], 0], "TestDataTable", AlternativeHypothesis -> "Greater"]
Out[3]=