New in Wolfram
Mathematica
8: Parameter Estimation and Testing
◄
previous
|
next
►
Core Algorithms
Simulate, Visualize, and Compare Power Curves for Tests of Location
Visually compare empirical powers for various tests of location as a function of the true location
.
In[1]:=
X
data = RandomVariate[NormalDistribution[], {500, 50}];
In[2]:=
X
tests = {"T", "Z", "SignedRank", "Sign"}; alts = {"Less", "Unequal", "Greater"}; res = Table[(Quiet@ LocationTest[#1, 0, i, AlternativeHypothesis -> j, VerifyTestAssumptions -> None] &) /@ data, {i, tests}, {j, alts}]; m = Mean /@ data; Grid[Join[{Map[ Style[#, Bold, FontFamily -> "Verdana"] &, {"", "\!\(\*SubscriptBox[\(H\), \(A\)]\): \[Mu] < \!\(\*SubscriptBox[\ \(\[Mu]\), \(0\)]\)", "\!\(\*SubscriptBox[\(H\), \(A\)]\): \[Mu] \[NotEqual] \ \!\(\*SubscriptBox[\(\[Mu]\), \(0\)]\)", "\!\(\*SubscriptBox[\(H\), \(A\)]\): \[Mu] > \!\(\*SubscriptBox[\ \(\[Mu]\), \(0\)]\)"}]}, Join[Partition[ Thread[Rotate[ Map[Style[#, Bold, FontFamily -> "Verdana"] &, {"t", "z", "signed rank", "sign"}], \[Pi]/2]], 1], Table[ListPlot[Transpose[{m, res[[i, j]]}], FrameTicks -> None, Frame -> True, PlotRange -> {{-.5, .5}, {0, 1}}, PlotStyle -> Hue[.992, .7, .7]], {i, 4}, {j, 3}], 2]], Spacings -> {.25, .25}]
Out[2]=