BUILT-IN MATHEMATICA SYMBOL

# LocationTest

LocationTest[data]
tests whether the mean or median of the data is zero.

LocationTest[{data1, data2}]
tests whether the means or medians of and are equal.

LocationTest[dspec, 0]
tests a location measure against .

LocationTest[dspec, 0, "property"]
returns the value of .

## Details and OptionsDetails and Options

• LocationTest performs a hypothesis test on data with null hypothesis that the true population location parameter is some value , and alternative hypothesis that .
• Given and , LocationTest tests that against that .
• 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 or multivariate .
• The argument can be a real number or a real vector with length equal to the dimension of the data.
• LocationTest[dspec] will choose the most powerful test that applies to dspec.
• LocationTest[dspec, Automatic] is equivalent to .
• LocationTest[dspec, 0, All] will choose all tests that apply to dspec.
• LocationTest[dspec, 0, "test"] reports the -value according to .
• Tests based on means assume the data in dspec is normally distributed. Some tests assume the data is symmetric about a common median. Tests that do not assume symmetry or normality are classified as robust.
• A paired sample test assumes equal-length dependent data.
• The following tests can be used:
•  "PairedT" normality paired sample test with unknown variance "PairedZ" normality paired sample test with known variance "Sign" robust median test for one sample or matched pairs "SignedRank" symmetry median test for one sample or matched pairs "T" normality mean test for one or two samples "MannWhitney" symmetry median test for two independent samples "Z" normality mean test with known variance
• The test performs Student -test for univariate data and Hotelling's test for multivariate data.
• The test performs a -test assuming the sample variance is the known variance for univariate data and Hotelling's test assuming the sample covariance is the known covariance for multivariate data.
• The and tests perform and tests on the paired differences of two datasets. A single dataset is treated as a list of differences.
• LocationTest[dspec, 0, "HypothesisTestData"] returns a HypothesisTestData object htd that can be used to extract additional test results and properties using the form htd["property"].
• LocationTest[dspec, 0, "property"] can be used to directly give the value of .
• Properties related to the reporting of test results include:
•  "AllTests" list of all applicable tests "AutomaticTest" test chosen if Automatic is used "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
• The following options can be used:
•  AlternativeHypothesis "Unequal" the inequality for the alternative hypothesis MaxIterations Automatic max iterations for multivariate median tests Method Automatic the method to use for computing -values SignificanceLevel 0.05 cutoff for diagnostics and reporting VerifyTestAssumptions Automatic what assumptions to verify
• For tests of location, a cutoff is chosen such that is rejected only if . The value of used for the and 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 .
• Named settings for VerifyTestAssumptions in LocationTest include:
•  "EqualVariance" verify that and have equal variance "Normality" verify that all data is normally distributed "Symmetry" verify symmetry about a common median

## ExamplesExamplesopen allclose all

### Basic Examples (3)Basic Examples (3)

Test whether the mean or median of a population is zero using a collection of tests:

 Out[2]=
 Out[3]=

Test whether the means of two populations differ by 2:

The mean difference :

 Out[2]=
 Out[3]=

At the level is significantly different from 2:

 Out[4]=

Compare the locations of multivariate populations:

The mean difference vector :

 Out[2]=
 Out[3]=

At the level is not significantly different from :

 Out[4]=