{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {
    "Notes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "In the following, let "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "d"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " represent the difference between the paired samples: "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "d = x - y"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " if both "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "x"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "y"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " are provided, or "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "d = x"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " otherwise. Assume that all elements of "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "d"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " are independent and identically distributed observations, and all are distinct and nonzero."
            }
          ]
        },
        {
          "__type": "BulletList",
          "__tag": 4053,
          "ordered": false,
          "start": 1,
          "children": [
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "When "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "len(d)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is sufficiently large, the null distribution of the   normalized test statistic ("
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "zstatistic",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " above) is approximately normal,   and "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "method = 'asymptotic'"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " can be used to compute the p-value."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "When "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "len(d)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is small, the normal approximation may not be accurate,   and "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "method='exact'"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is preferred (at the cost of additional   execution time)."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The default, "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "method='auto'"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", selects between the two:   "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "method='exact'"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is used when "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "len(d) <= 50"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", and   "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "method='asymptotic'"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is used otherwise."
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The presence of \"ties\" (i.e. not all elements of "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "d"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " are unique) or \"zeros\" (i.e. elements of "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "d"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " are zero) changes the null distribution of the test statistic, and "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "method='exact'"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " no longer calculates the exact p-value. If "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "method='asymptotic'"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", the z-statistic is adjusted for more accurate comparison against the standard normal, but still, for finite sample sizes, the standard normal is only an approximation of the true null distribution of the z-statistic. For such situations, the "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "method"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " parameter also accepts instances 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": ". In this case, the p-value is computed using "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "permutation_test",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "module",
                "path": "scipy.stats._resampling:permutation_test"
              },
              "kind": "module"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " with the provided configuration options and other appropriate settings."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The presence of ties and zeros affects the resolution of "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "method='auto'"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " accordingly: exhaustive permutations are performed when "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "len(d) <= 13"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", and the asymptotic method is used otherwise. Note that they asymptotic method may not be very accurate even for "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "len(d) > 14"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "; the threshold was chosen as a compromise between execution time and accuracy under the constraint that the results must be deterministic. Consider providing 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": " method manually, choosing the "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "n_resamples"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " parameter to balance time constraints and accuracy requirements."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Please also note that in the edge case that all elements of "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "d"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " are zero, the p-value relying on the normal approximaton cannot be computed (NaN) if "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "zero_method='wilcox'"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " or "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "zero_method='pratt'"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Beginning in SciPy 1.9, "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "np.matrix"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " inputs (not recommended for new code) are converted to "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "np.ndarray"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " before the calculation is performed. In this case, the output will be a scalar or "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "np.ndarray"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " of appropriate shape rather than a 2D "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "np.matrix"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ". Similarly, while masked elements of masked arrays are ignored, the output will be a scalar or "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "np.ndarray"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " rather than a masked array with "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "mask=False"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "."
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Raises": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "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": "result",
              "annotation": "WilcoxonResult",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "An object with the following 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": "If "
                            },
                            {
                              "__type": "ParamRef",
                              "__tag": 4071,
                              "name": "alternative"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": " is \"two-sided\", the sum of the ranks of the     differences above or below zero, whichever is smaller.     Otherwise the sum of the ranks of the differences above zero."
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__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 p-value for the test depending on "
                            },
                            {
                              "__type": "ParamRef",
                              "__tag": 4071,
                              "name": "alternative"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": " and "
                            },
                            {
                              "__type": "ParamRef",
                              "__tag": 4071,
                              "name": "method"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "."
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "DefListItem",
                      "__tag": 4037,
                      "dt": {
                        "__type": "Paragraph",
                        "__tag": 4045,
                        "children": [
                          {
                            "__type": "Text",
                            "__tag": 4046,
                            "value": "zstatistic"
                          }
                        ]
                      },
                      "dd": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "When "
                            },
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "method = 'asymptotic'"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ", this is the normalized z-statistic          "
                            }
                          ]
                        },
                        {
                          "__type": "Code",
                          "__tag": 4050,
                          "value": "z = (T - mn - d) / se",
                          "execution_status": null,
                          "out": ""
                        },
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "where "
                            },
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "T"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": " is "
                            },
                            {
                              "__type": "InlineRole",
                              "__tag": 4003,
                              "value": "statistic",
                              "domain": null,
                              "role": null,
                              "inventory": null
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": " as defined above, "
                            },
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "mn"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": " is the mean of the     distribution under the null hypothesis, "
                            },
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "d"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": " is a continuity     correction, and "
                            },
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "se"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": " is the standard error.     When "
                            },
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "method != 'asymptotic'"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ", this attribute is not available."
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Calculate the Wilcoxon signed-rank test."
            }
          ]
        }
      ],
      "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": "x",
              "annotation": "array_like",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Either the first set of measurements (in which case "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "y"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is the second set of measurements), or the differences between two sets of measurements (in which case "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "y"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is not to be specified.)  Must be one-dimensional."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "y",
              "annotation": "array_like, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Either the second set of measurements (if "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "x"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is the first set of measurements), or not specified (if "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "x"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is the differences between two sets of measurements.)  Must be one-dimensional."
                    }
                  ]
                },
                {
                  "__type": "Admonition",
                  "__tag": 4056,
                  "kind": "warning",
                  "base_type": "warning",
                  "children": [
                    {
                      "__type": "AdmonitionTitle",
                      "__tag": 4055,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "warning "
                        }
                      ]
                    },
                    {
                      "__type": "Paragraph",
                      "__tag": 4045,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "When "
                        },
                        {
                          "__type": "ParamRef",
                          "__tag": 4071,
                          "name": "y"
                        },
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": " is provided, "
                        },
                        {
                          "__type": "CrossRef",
                          "__tag": 4002,
                          "value": "wilcoxon",
                          "reference": {
                            "__type": "LocalRef",
                            "__tag": 4022,
                            "kind": "module",
                            "path": "scipy.stats._morestats:wilcoxon"
                          },
                          "kind": "module"
                        },
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": " calculates the test statistic based on the ranks of the absolute values of "
                        },
                        {
                          "__type": "InlineCode",
                          "__tag": 4051,
                          "value": "d = x - y"
                        },
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": ". Roundoff error in the subtraction can result in elements of "
                        },
                        {
                          "__type": "InlineCode",
                          "__tag": 4051,
                          "value": "d"
                        },
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": " being assigned different ranks even when they would be tied with exact arithmetic. Rather than passing "
                        },
                        {
                          "__type": "ParamRef",
                          "__tag": 4071,
                          "name": "x"
                        },
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": " and "
                        },
                        {
                          "__type": "ParamRef",
                          "__tag": 4071,
                          "name": "y"
                        },
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": " separately, consider computing the difference "
                        },
                        {
                          "__type": "InlineCode",
                          "__tag": 4051,
                          "value": "x - y"
                        },
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": ", rounding as needed to ensure that only truly unique elements are numerically distinct, and passing the result as "
                        },
                        {
                          "__type": "ParamRef",
                          "__tag": 4071,
                          "name": "x"
                        },
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": ", leaving "
                        },
                        {
                          "__type": "ParamRef",
                          "__tag": 4071,
                          "name": "y"
                        },
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": " at the default (None)."
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "zero_method",
              "annotation": "{\"wilcox\", \"pratt\", \"zsplit\"}, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "There are different conventions for handling pairs of observations with equal values (\"zero-differences\", or \"zeros\")."
                    }
                  ]
                },
                {
                  "__type": "BulletList",
                  "__tag": 4053,
                  "ordered": false,
                  "start": 1,
                  "children": [
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "\"wilcox\": Discards all zero-differences (default); see "
                            },
                            {
                              "__type": "FootnoteReference",
                              "__tag": 4066,
                              "label": "4"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "."
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "\"pratt\": Includes zero-differences in the ranking process,   but drops the ranks of the zeros (more conservative); see "
                            },
                            {
                              "__type": "FootnoteReference",
                              "__tag": 4066,
                              "label": "3"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ".   In this case, the normal approximation is adjusted as in "
                            },
                            {
                              "__type": "FootnoteReference",
                              "__tag": 4066,
                              "label": "5"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "."
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "\"zsplit\": Includes zero-differences in the ranking process and   splits the zero rank between positive and negative ones."
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "correction",
              "annotation": "bool, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "If True, apply continuity correction by adjusting the Wilcoxon rank statistic by 0.5 towards the mean value when computing the z-statistic if a normal approximation is used.  Default is False."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "alternative",
              "annotation": "{\"two-sided\", \"greater\", \"less\"}, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Defines the alternative hypothesis. Default is 'two-sided'. In the following, let "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "d"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " represent the difference between the paired samples: "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "d = x - y"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " if both "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "x"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "y"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " are provided, or "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "d = x"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " otherwise."
                    }
                  ]
                },
                {
                  "__type": "BulletList",
                  "__tag": 4053,
                  "ordered": false,
                  "start": 1,
                  "children": [
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "'two-sided': the distribution underlying "
                            },
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "d"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": " is not symmetric   about zero."
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "'less': the distribution underlying "
                            },
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "d"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": " is stochastically less   than a distribution symmetric about zero."
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "'greater': the distribution underlying "
                            },
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "d"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": " is stochastically   greater than a distribution symmetric about zero."
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "method",
              "annotation": "{\"auto\", \"exact\", \"asymptotic\"} or `PermutationMethod` instance, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Method to calculate the p-value, see Notes. Default is \"auto\"."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "axis",
              "annotation": "int or None, default: 0",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "If an int, the axis of the input along which to compute the statistic. The statistic of each axis-slice (e.g. row) of the input will appear in a corresponding element of the output. If "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "None"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", the input will be raveled before computing the statistic."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "nan_policy",
              "annotation": "{'propagate', 'omit', 'raise'}",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Defines how to handle input NaNs."
                    }
                  ]
                },
                {
                  "__type": "BulletList",
                  "__tag": 4053,
                  "ordered": false,
                  "start": 1,
                  "children": [
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "propagate"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ": if a NaN is present in the axis slice (e.g. row) along   which the  statistic is computed, the corresponding entry of the output   will be NaN."
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "omit"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ": NaNs will be omitted when performing the calculation.   If insufficient data remains in the axis slice along which the   statistic is computed, the corresponding entry of the output will be   NaN."
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "raise"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": ": if a NaN is present, a "
                            },
                            {
                              "__type": "InlineCode",
                              "__tag": 4051,
                              "value": "ValueError"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": " will be raised."
                            }
                          ]
                        }
                      ]
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "nan_policy='raise'"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "nan_policy='omit'"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " are not supported by lazy backends, and "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "nan_policy='omit'"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is not compatible with MArray input. For multidimensional input, "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "nan_policy='omit'"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is supported only by the NumPy backend. Instead, mask NaN values using "
                    },
                    {
                      "__type": "Link",
                      "__tag": 4049,
                      "children": [
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "MArray"
                        }
                      ],
                      "url": "https://mdhaber.github.io/marray/tutorial.html",
                      "title": ""
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "; and use the default "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "nan_policy"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". See Notes for support information."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "keepdims",
              "annotation": "bool, default: False",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "If this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input array."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The Wilcoxon signed-rank test tests the null hypothesis that two related paired samples come from the same distribution. In particular, it tests whether the distribution of the differences "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "x - y"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is symmetric about zero. It is a non-parametric version of the paired T-test."
            }
          ]
        }
      ],
      "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": "build-install/usr/lib/python3.14/site-packages/scipy/stats/_morestats.py",
  "item_line": 3914,
  "item_type": "function",
  "aliases": [
    "scipy.stats.wilcoxon"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "In [4]_, the differences in height between cross- and self-fertilized\ncorn plants is given as follows:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "d = [6, 8, 14, 16, 23, 24, 28, 29, 41, -48, 49, 56, 60, -67, 75]\n",
        "execution_status": "success",
        "out": ""
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nCross-fertilized plants appear to be higher. To test the null\nhypothesis that there is no height difference, we can apply the\ntwo-sided test:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "from scipy.stats import wilcoxon\nres = wilcoxon(d)\n",
        "execution_status": "success",
        "out": ""
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "res.statistic, res.pvalue\n",
        "execution_status": "failure",
        "out": "(np.float64(24.0), np.float64(0.041259765625))\n"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nHence, we would reject the null hypothesis at a confidence level of 5%,\nconcluding that there is a difference in height between the groups.\nTo confirm that the median of the differences can be assumed to be\npositive, we use:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "res = wilcoxon(d, alternative='greater')\n",
        "execution_status": "success",
        "out": ""
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "res.statistic, res.pvalue\n",
        "execution_status": "failure",
        "out": "(np.float64(96.0), np.float64(0.0206298828125))\n"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nThis shows that the null hypothesis that the median is negative can be\nrejected at a confidence level of 5% in favor of the alternative that\nthe median is greater than zero. The p-values above are exact. Using the\nnormal approximation gives very similar values:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "res = wilcoxon(d, method='asymptotic')\n",
        "execution_status": "success",
        "out": ""
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "res.statistic, res.pvalue\n",
        "execution_status": "failure",
        "out": "(np.float64(24.0), np.float64(0.04088813291185591))\n"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nNote that the statistic changed to 96 in the one-sided case (the sum\nof ranks of positive differences) whereas it is 24 in the two-sided\ncase (the minimum of sum of ranks above and below zero).\n\nIn the example above, the differences in height between paired plants are\nprovided to `wilcoxon` directly. Alternatively, `wilcoxon` accepts two\nsamples of equal length, calculates the differences between paired\nelements, then performs the test. Consider the samples ``x`` and ``y``:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "import numpy as np\nx = np.array([0.5, 0.825, 0.375, 0.5])\ny = np.array([0.525, 0.775, 0.325, 0.55])\nres = wilcoxon(x, y, alternative='greater')\n",
        "execution_status": "success",
        "out": ""
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "res\n",
        "execution_status": "failure",
        "out": "WilcoxonResult(statistic=np.float64(5.0), pvalue=np.float64(0.5625))\n"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nNote that had we calculated the differences by hand, the test would have\nproduced different results:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "d = [-0.025, 0.05, 0.05, -0.05]\nref = wilcoxon(d, alternative='greater')\n",
        "execution_status": "success",
        "out": ""
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "ref\n",
        "execution_status": "failure",
        "out": "WilcoxonResult(statistic=np.float64(6.0), pvalue=np.float64(0.5))\n"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nThe substantial difference is due to roundoff error in the results of\n``x-y``:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "d - (x-y)\n",
        "execution_status": "failure",
        "out": "array([0., 0., 0., 0.])\n"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nEven though we expected all the elements of ``(x-y)[1:]`` to have the same\nmagnitude ``0.05``, they have slightly different magnitudes in practice,\nand therefore are assigned different ranks in the test. Before performing\nthe test, consider calculating ``d`` and adjusting it as necessary to\nensure that theoretically identically values are not numerically distinct.\nFor example:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "d2 = np.around(x - y, decimals=3)\n",
        "execution_status": "success",
        "out": ""
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "wilcoxon(d2, alternative='greater')\n",
        "execution_status": "failure",
        "out": "WilcoxonResult(statistic=np.float64(6.0), pvalue=np.float64(0.5))\n"
      }
    ],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "kruskal",
        "reference": {
          "__type": "RefInfo",
          "__tag": 4000,
          "module": "current-module",
          "version": "current-version",
          "kind": "to-resolve",
          "path": "kruskal"
        },
        "kind": "module"
      },
      "descriptions": [],
      "type": "func"
    },
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "mannwhitneyu",
        "reference": {
          "__type": "RefInfo",
          "__tag": 4000,
          "module": "current-module",
          "version": "current-version",
          "kind": "to-resolve",
          "path": "mannwhitneyu"
        },
        "kind": "module"
      },
      "descriptions": [],
      "type": "func"
    }
  ],
  "signature": {
    "__type": "SignatureNode",
    "__tag": 4029,
    "kind": "function",
    "parameters": [
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "x",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "y",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "None"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "zero_method",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "wilcox"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "correction",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "False"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "alternative",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "two-sided"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "method",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "auto"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "axis",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "KEYWORD_ONLY",
        "default": "0"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "nan_policy",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "KEYWORD_ONLY",
        "default": "propagate"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "keepdims",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "KEYWORD_ONLY",
        "default": "False"
      }
    ],
    "return_annotation": {
      "__type": "Empty",
      "__tag": 4031
    },
    "target_name": "wilcoxon"
  },
  "references": [
    ".. [1] https://en.wikipedia.org/wiki/Wilcoxon_signed-rank_test",
    ".. [2] Conover, W.J., Practical Nonparametric Statistics, 1971.",
    ".. [3] Pratt, J.W., Remarks on Zeros and Ties in the Wilcoxon Signed",
    "   Rank Procedures, Journal of the American Statistical Association,",
    "   Vol. 54, 1959, pp. 655-667. :doi:`10.1080/01621459.1959.10501526`",
    ".. [4] Wilcoxon, F., Individual Comparisons by Ranking Methods,",
    "   Biometrics Bulletin, Vol. 1, 1945, pp. 80-83. :doi:`10.2307/3001968`",
    ".. [5] Cureton, E.E., The Normal Approximation to the Signed-Rank",
    "   Sampling Distribution When Zero Differences are Present,",
    "   Journal of the American Statistical Association, Vol. 62, 1967,",
    "   pp. 1068-1069. :doi:`10.1080/01621459.1967.10500917`"
  ],
  "qa": "scipy.stats._morestats:wilcoxon",
  "arbitrary": [],
  "local_refs": [
    "alternative",
    "axis",
    "correction",
    "keepdims",
    "method",
    "nan_policy",
    "result",
    "x",
    "y",
    "zero_method"
  ]
}