{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {
    "Notes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "FootnoteReference",
              "__tag": 4066,
              "label": "1"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " defines three versions of the k-sample Anderson-Darling test: one for continuous distributions and two for discrete distributions, in which ties between samples may occur. The default of this routine is to compute the version based on the midrank empirical distribution function. This test is applicable to continuous and discrete data. If "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "variant"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is set to "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "'discrete'"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", the right side empirical distribution is used for a test for discrete data; if "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "variant"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "'continuous'"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", the same test statistic and p-value are computed for data with no ties, but with less computation. According to "
            },
            {
              "__type": "FootnoteReference",
              "__tag": 4066,
              "label": "1"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", the two discrete test statistics differ only slightly if a few collisions due to round-off errors occur in the test not adjusted for ties between samples."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The critical values corresponding to the significance levels from 0.01 to 0.25 are taken from "
            },
            {
              "__type": "FootnoteReference",
              "__tag": 4066,
              "label": "1"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ". p-values are floored / capped at 0.1% / 25%. Since the range of critical values might be extended in future releases, it is recommended not to test "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "p == 0.25"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", but rather "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "p >= 0.25"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " (analogously for the lower bound)."
            }
          ]
        },
        {
          "__type": "Admonition",
          "__tag": 4056,
          "kind": "versionadded",
          "base_type": "neutral",
          "children": [
            {
              "__type": "AdmonitionTitle",
              "__tag": 4055,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "versionadded 0.14.0"
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Raises": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "",
              "annotation": "ValueError",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "If fewer than 2 samples are provided, a sample is empty, or no distinct observations are in the samples."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Yields": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Methods": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Returns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "res",
              "annotation": "Anderson_ksampResult",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "An object containing attributes:"
                    }
                  ]
                },
                {
                  "__type": "DefList",
                  "__tag": 4033,
                  "children": [
                    {
                      "__type": "DefListItem",
                      "__tag": 4037,
                      "dt": {
                        "__type": "Paragraph",
                        "__tag": 4045,
                        "children": [
                          {
                            "__type": "Text",
                            "__tag": 4046,
                            "value": "statistic"
                          }
                        ]
                      },
                      "dd": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "Normalized k-sample Anderson-Darling test statistic."
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "DefListItem",
                      "__tag": 4037,
                      "dt": {
                        "__type": "Paragraph",
                        "__tag": 4045,
                        "children": [
                          {
                            "__type": "Text",
                            "__tag": 4046,
                            "value": "critical_values"
                          }
                        ]
                      },
                      "dd": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "The critical values for significance levels 25%, 10%, 5%, 2.5%, 1%,     0.5%, 0.1%."
                            }
                          ]
                        },
                        {
                          "__type": "Admonition",
                          "__tag": 4056,
                          "kind": "deprecated",
                          "base_type": "neutral",
                          "children": [
                            {
                              "__type": "AdmonitionTitle",
                              "__tag": 4055,
                              "children": [
                                {
                                  "__type": "Text",
                                  "__tag": 4046,
                                  "value": "deprecated 1.17.0"
                                }
                              ]
                            },
                            {
                              "__type": "Paragraph",
                              "__tag": 4045,
                              "children": [
                                {
                                  "__type": "Text",
                                  "__tag": 4046,
                                  "value": "Present only when "
                                },
                                {
                                  "__type": "ParamRef",
                                  "__tag": 4071,
                                  "name": "variant"
                                },
                                {
                                  "__type": "Text",
                                  "__tag": 4046,
                                  "value": " is unspecified."
                                }
                              ]
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "DefListItem",
                      "__tag": 4037,
                      "dt": {
                        "__type": "Paragraph",
                        "__tag": 4045,
                        "children": [
                          {
                            "__type": "Text",
                            "__tag": 4046,
                            "value": "pvalue"
                          }
                        ]
                      },
                      "dd": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "The approximate p-value of the test. If "
                            },
                            {
                              "__type": "ParamRef",
                              "__tag": 4071,
                              "name": "method"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": " is not     provided, the value is floored / capped at 0.1% / 25%."
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The Anderson-Darling test for k-samples."
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Receives": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warnings": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Attributes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Parameters",
          "__tag": 4026,
          "children": [
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "samples",
              "annotation": "sequence of 1-D array_like",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Array of sample data in arrays."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "midrank",
              "annotation": "bool, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Variant of Anderson-Darling test which is computed. Default (True) is the midrank test applicable to continuous and discrete populations. If False, the right side empirical distribution is used."
                    }
                  ]
                },
                {
                  "__type": "Admonition",
                  "__tag": 4056,
                  "kind": "deprecated",
                  "base_type": "neutral",
                  "children": [
                    {
                      "__type": "AdmonitionTitle",
                      "__tag": 4055,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "deprecated 1.17.0"
                        }
                      ]
                    },
                    {
                      "__type": "Paragraph",
                      "__tag": 4045,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "Use parameter "
                        },
                        {
                          "__type": "ParamRef",
                          "__tag": 4071,
                          "name": "variant"
                        },
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": " instead."
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "variant",
              "annotation": "{'midrank', 'right', 'continuous'}",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Variant of Anderson-Darling test to be computed. "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "'midrank'"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is applicable to both continuous and discrete populations. "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "'discrete'"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "'continuous'"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " perform alternative versions of the test for discrete  and continuous populations, respectively. When "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "variant"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is specified, the return object will not be unpackable as a tuple, and only attributes "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "statistic"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "pvalue"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " will be present."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "method",
              "annotation": "PermutationMethod, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Defines the method used to compute the p-value. If "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "method"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is an instance of "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "PermutationMethod",
                      "reference": {
                        "__type": "LocalRef",
                        "__tag": 4022,
                        "kind": "module",
                        "path": "scipy.stats._resampling:PermutationMethod"
                      },
                      "kind": "module"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", the p-value is computed using "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "scipy.stats.permutation_test",
                      "reference": {
                        "__type": "RefInfo",
                        "__tag": 4000,
                        "module": "scipy",
                        "version": "?",
                        "kind": "module",
                        "path": "scipy.stats._resampling:permutation_test"
                      },
                      "kind": "module"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " with the provided configuration options and other appropriate settings. Otherwise, the p-value is interpolated from tabulated values."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The k-sample Anderson-Darling test is a modification of the one-sample Anderson-Darling test. It tests the null hypothesis that k-samples are drawn from the same population without having to specify the distribution function of that population. The critical values depend on the number of samples."
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Other Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    }
  },
  "_ordered_sections": [
    "Summary",
    "Extended Summary",
    "Parameters",
    "Attributes",
    "Methods",
    "Returns",
    "Yields",
    "Receives",
    "Other Parameters",
    "Raises",
    "Warns",
    "Warnings",
    "Notes"
  ],
  "item_file": "/scipy/stats/_morestats.py",
  "item_line": 2758,
  "item_type": "function",
  "aliases": [
    "scipy.stats.anderson_ksamp"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "import numpy as np\nfrom scipy import stats\nrng = np.random.default_rng(44925884305279435)\nres = stats.anderson_ksamp([rng.normal(size=50), rng.normal(loc=0.5, size=30)],\n                           variant='midrank')\n",
        "execution_status": "success",
        "out": ""
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "res.statistic, res.pvalue\n",
        "execution_status": "failure",
        "out": "(np.float64(3.4444310693448936), 0.01310668240672096)\n"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nThe null hypothesis that the two random samples come from the same\ndistribution can be rejected at the 5% level because the returned\np-value is less than 0.05, but not at the 1% level.\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "samples = [rng.normal(size=50), rng.normal(size=30),\n           rng.normal(size=20)]\nres = stats.anderson_ksamp(samples, variant='continuous')\n",
        "execution_status": "success",
        "out": ""
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "res.statistic, res.pvalue\n",
        "execution_status": "failure",
        "out": "(np.float64(-0.6309662273193832), np.float64(0.25))\n"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nAs we might expect, the null hypothesis cannot be rejected here for three samples\nfrom an identical distribution. The reported p-value (25%) has been capped at the\nmaximum value for which pre-computed p-values are available.\n\nIn such cases where the p-value is capped or when sample sizes are\nsmall, a permutation test may be more accurate.\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "method = stats.PermutationMethod(n_resamples=9999, random_state=rng)\nres = stats.anderson_ksamp(samples, variant='continuous', method=method)\n",
        "execution_status": "success",
        "out": ""
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "res.pvalue\n",
        "execution_status": "failure",
        "out": "np.float64(0.699)\n"
      }
    ],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "anderson",
        "reference": {
          "__type": "LocalRef",
          "__tag": 4022,
          "kind": "module",
          "path": "scipy.stats._morestats:anderson"
        },
        "kind": "module"
      },
      "descriptions": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "1 sample Anderson-Darling test"
            }
          ]
        }
      ],
      "type": "func"
    },
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "ks_2samp",
        "reference": {
          "__type": "RefInfo",
          "__tag": 4000,
          "module": "current-module",
          "version": "current-version",
          "kind": "to-resolve",
          "path": "ks_2samp"
        },
        "kind": "module"
      },
      "descriptions": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "2 sample Kolmogorov-Smirnov test"
            }
          ]
        }
      ],
      "type": "func"
    }
  ],
  "signature": {
    "__type": "SignatureNode",
    "__tag": 4029,
    "kind": "function",
    "parameters": [
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "samples",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "midrank",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "<object object at 0x0000>"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "variant",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "KEYWORD_ONLY",
        "default": "<object object at 0x0000>"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "method",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "KEYWORD_ONLY",
        "default": "None"
      }
    ],
    "return_annotation": {
      "__type": "Empty",
      "__tag": 4031
    },
    "target_name": "anderson_ksamp"
  },
  "references": [
    ".. [1] Scholz, F. W and Stephens, M. A. (1987), K-Sample",
    "       Anderson-Darling Tests, Journal of the American Statistical",
    "       Association, Vol. 82, pp. 918-924."
  ],
  "qa": "scipy.stats._morestats:anderson_ksamp",
  "arbitrary": [],
  "local_refs": [
    "method",
    "midrank",
    "res",
    "samples",
    "variant"
  ]
}