Wolfram Language & System 10.0 (2014)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.View current documentation (Version 11.2)


tests whether data is normally distributed.

tests whether data is distributed according to dist.

returns the value of .

Details and OptionsDetails and Options

  • DistributionFitTest performs a goodness-of-fit hypothesis test with null hypothesis that data was drawn from a population with distribution dist and alternative hypothesis that it was not.
  • By default, a probability value or -value is returned.
  • A small -value suggests that it is unlikely that the data came from dist.
  • The dist can be any symbolic distribution with numeric and symbolic parameters or a dataset.
  • The data can be univariate or multivariate .
  • DistributionFitTest[data,dist,Automatic] will choose the most powerful test that applies to data and dist for a general alternative hypothesis.
  • DistributionFitTest[data,dist,All] will choose all tests that apply to data and dist.
  • DistributionFitTest[data,dist,"test"] reports the -value according to .
  • Many of the tests use the CDF of the test distribution dist and the empirical CDF of the data as well as their difference and =Expectation[d(x),]. The CDFs and should be the same under the null hypothesis .
  • The following tests can be used for univariate or multivariate distributions:
  • "AndersonDarling"distribution, databased on Expectation[]
    "CramerVonMises"distribution, databased on Expectation[d(x)2]
    "JarqueBeraALM"normalitybased on skewness and kurtosis
    "KolmogorovSmirnov"distribution, databased on sup_x TemplateBox[{{d, (, x, )}}, Abs]
    "Kuiper"distribution, databased on
    "PearsonChiSquare"distribution, databased on expected and observed histogram
    "ShapiroWilk"normalitybased on quantiles
    "WatsonUSquare"distribution, databased on Expectation[(d(x))2]
  • The following tests can be used for multivariate distributions:
  • "DistanceToBoundary"uniformitybased on distance to uniform boundaries
    "MardiaCombined"normalitycombined Mardia skewness and kurtosis
    "MardiaKurtosis"normalitybased on multivariate kurtosis
    "MardiaSkewness"normalitybased on multivariate skewness
    "SzekelyEnergy"databased on Newton's potential energy
  • DistributionFitTest[data,dist,"HypothesisTestData"] returns a HypothesisTestData object htd that can be used to extract additional test results and properties using the form htd["property"].
  • DistributionFitTest[data,dist,"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 properties are independent of which test is being performed.
  • Properties related to the data distribution include:
  • "FittedDistribution"fitted distribution of data
    "FittedDistributionParameters"distribution parameters of data
  • The following options can be given:
  • MethodAutomaticthe method to use for computing -values
    SignificanceLevel0.05cutoff for diagnostics and reporting
  • For a test for goodness of fit, a cutoff is chosen such that is rejected only if . The value of used for the and properties is controlled by the SignificanceLevel option. By default is set to 0.05.
  • With the setting Method->"MonteCarlo", datasets of the same length as the input are generated under using the fitted distribution. The EmpiricalDistribution from DistributionFitTest[si,dist,{"TestStatistic",test}] is then used to estimate the -value.

ExamplesExamplesopen allclose all

Basic Examples  (3)Basic Examples  (3)

Test some data for normality:

Click for copyable input
Click for copyable input

Create a HypothesisTestData object for further property extraction:

Click for copyable input

The full test table:

Click for copyable input

Compare the histogram of the data to the PDF of the test distribution:

Click for copyable input

Test the fit of a set of data to a particular distribution:

Click for copyable input

Extract the AndersonDarling test table:

Click for copyable input

Verify the test results with ProbabilityPlot:

Click for copyable input

Test data for goodness of fit to a multivariate distribution:

Click for copyable input
Click for copyable input
Click for copyable input

Plot the marginal PDFs of the test distribution against the data to confirm the test results:

Click for copyable input
Introduced in 2010