On 2/11/2011 3:19 AM, Francisco Gutierrez wrote:
> Dear Group:
> Mathematica's statistical capacities have been enhanced in the last versions. However, I have two questions:
>
> a. Has anybody developed code for doing multi-level regressions in Mathematica? If yes, where can it be found?
>
> b. A simple but important command, MeanDifferenceTest was made obsolete. However, it was quite nice. It still works, but Mathematica informs it has been "superseded". Furthermore, the commands that are supposed to replace it, like LocationEquivalenceTest, seem inferior, and produce different results. How to interpret such differences? Anyway I hope MeanDifferenceTest is not wiped from the surface of the earth!
>
> Best,
> Francisco
>
>
>
>
MeanDifferenceTest has been replaced by a collection of tests including
LocationEquivalenceTest, LocationTest, and a number of individual named
tests such as SignTest, SignedRankTest, TTest, and ZTest.
LocationEquivalenceTest is designed primarily to test for equivalence in
means for 3 or more populations and so isn't likely to give the results
you are wanting compared to MeanDifferenceTest. LocationTest contains
many more tests (both nonparametric and parametric) and automates
choosing an appropriate one.
If you are really wanting to perform what MeanDifferenceTest does you
should use either TTest, or ZTest.
Some of the examples in MeanDifferenceTest are a bit difficult to
replicate because of the underlying assumptions of the test. For the
first basic example we have to force TTest to use Satterthwaite degrees
of freedom. Also, the p-value is one-sided by default in
MeanDifferenceTest. We now return a two-sided value by default and allow
control over the direction.
The first example in MeanDifferenceTest is one of the hardest to
replicate...
In[2]:= MeanDifferenceTest[{1, 2, 4, 6, 3}, {4, 10, 6, 8, 5, 8}, 0]
Out[2]= OneSidedPValue -> 0.00879997
Notice that the degrees of freedom default to 9 (not the Satterthwaite
degrees of freedom..)
In[46]:= TTest[{{1, 2, 4, 6, 3}, {4, 10, 6, 8, 5,
8}}, 0, "DegreesOfFreedom"]
Out[46]= 9
This is because the variances of the two populations were not detected
to be significantly different from one another at the default
significance level...
In[40]:= VarianceEquivalenceTest[{{1, 2, 4, 6, 3}, {4, 10, 6, 8, 5,
8}}]
Out[40]= 0.7641
We can force the Satterthwaite degrees of freedom by setting the
significance level above this value.
In[48]:= TTest[{{1, 2, 4, 6, 3}, {4, 10, 6, 8, 5,
8}}, 0, "DegreesOfFreedom", SignificanceLevel -> .8]
Out[48]= 8.9724
With the proper alternative hypothesis setting we reproduce
MeanDifferenceTest.
In[49]:= TTest[{{1, 2, 4, 6, 3}, {4, 10, 6, 8, 5, 8}}, 0, "PValue",
AlternativeHypothesis -> "Less", SignificanceLevel -> .8]
Out[49]= 0.00879997
We have to work far less hard to get the example under "EqualVariances"
since these are detected by default.
In[2]:= MeanDifferenceTest[{1, 2, 4, 6, 3}, {4, 10, 6, 8, 5, 8}, 0,
EqualVariances -> True]
Out[2]= OneSidedPValue -> 0.00940084
In[51]:= TTest[{{1, 2, 4, 6, 3}, {4, 10, 6, 8, 5, 8}}, 0, "PValue",
AlternativeHypothesis -> "Less"]
Out[51]= 0.00940084
To assume known variances as in the "KnownVariance" example use ZTest.
In[2]:= MeanDifferenceTest[{1, 2, 4, 6, 3}, {4, 10, 6, 8, 5, 8}, 0,
KnownVariance -> {1, 3}]
Out[2]= OneSidedPValue -> 7.03827*10^-6
In[54]:= ZTest[{{1, 2, 4, 6, 3}, {4, 10, 6, 8, 5, 8}}, {1, 3}, 0,
AlternativeHypothesis -> "Less"]
Out[54]= 7.03827*10^-6
The reporting features offered by MeanDifferenceTest have not been
completely replicated by design. You can still automatically generate
nice test summary tables and all of the information for constructing the
old table is readily available by extracting properties from the
"HypothesisTestData" object. You can also still get test conclusions as
strings.
Hope this helps. Any suggestions on improvements are most welcome.
Andy Ross
Wolfram Research