{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {
    "Notes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "This function preserves ndarray subclasses, and works also with matrices and masked arrays (it uses "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "asanyarray"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " instead of "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "asarray"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " for parameters)."
            }
          ]
        },
        {
          "__type": "Admonition",
          "__tag": 4056,
          "kind": "versionadded",
          "base_type": "neutral",
          "children": [
            {
              "__type": "AdmonitionTitle",
              "__tag": 4055,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "versionadded 1.8"
                }
              ]
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Strong",
              "__tag": 4048,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "Array API Standard Support"
                }
              ]
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "gzscore",
              "reference": {
                "__type": "RefInfo",
                "__tag": 4000,
                "module": null,
                "version": null,
                "kind": "local",
                "path": "gzscore"
              },
              "kind": "local"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " has experimental support for Python Array API Standard compatible backends in addition to NumPy. Please consider testing these features by setting an environment variable "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "SCIPY_ARRAY_API=1"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and providing CuPy, PyTorch, JAX, or Dask arrays as array arguments. The following combinations of backend and device (or other capability) are supported."
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "====================  ====================  ====================\nLibrary               CPU                   GPU\n====================  ====================  ====================\nNumPy                 ✅                     n/a                 \nCuPy                  n/a                   ✅                   \nPyTorch               ✅                     ✅                   \nJAX                   ✅                     ✅                   \nDask                  ✅                     n/a                 \n====================  ====================  ====================",
          "execution_status": null,
          "out": ""
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "gzscore",
              "reference": {
                "__type": "RefInfo",
                "__tag": 4000,
                "module": null,
                "version": null,
                "kind": "local",
                "path": "gzscore"
              },
              "kind": "local"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " also accepts "
            },
            {
              "__type": "Link",
              "__tag": 4049,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "MArrays"
                }
              ],
              "url": "https://mdhaber.github.io/marray/tutorial.html",
              "title": ""
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " backed by the backends indicated above; masked values will be treated as though they were not present."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "See "
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "dev-arrayapi",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "docs",
                "path": "dev:api-dev:array_api"
              },
              "kind": "exists"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " for more information."
            }
          ]
        }
      ],
      "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": "gzscore",
              "annotation": "array_like",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The geometric z scores, standardized by geometric mean and geometric standard deviation of input array "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "a"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Compute the geometric standard score."
            }
          ]
        }
      ],
      "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": "a",
              "annotation": "array_like",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Sample data."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "axis",
              "annotation": "int or None, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Axis along which to operate. Default is 0. If None, compute over the whole array "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "a"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "ddof",
              "annotation": "int, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Degrees of freedom correction in the calculation of the standard deviation. Default is 0."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "nan_policy",
              "annotation": "{'propagate', 'raise', 'omit'}, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Defines how to handle when input contains nan. 'propagate' returns nan, 'raise' throws an error, 'omit' performs the calculations ignoring nan values. Default is 'propagate'.  Note that when the value is 'omit', nans in the input also propagate to the output, but they do not affect the geometric z scores computed for the non-nan values."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Compute the geometric z score of each strictly positive value in the sample, relative to the geometric mean and standard deviation. Mathematically the geometric z score can be evaluated as      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "gzscore = log(a/gmu) / log(gsigma)",
          "execution_status": null,
          "out": ""
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "where "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "gmu"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " (resp. "
            },
            {
              "__type": "InlineCode",
              "__tag": 4051,
              "value": "gsigma"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ") is the geometric mean (resp. standard deviation)."
            }
          ]
        }
      ],
      "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/_stats_py.py",
  "item_line": 2757,
  "item_type": "function",
  "aliases": [
    "scipy.stats.gzscore"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "Draw samples from a log-normal distribution:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "import numpy as np\nfrom scipy.stats import zscore, gzscore\nimport matplotlib.pyplot as plt\n",
        "execution_status": "success",
        "out": ""
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "rng = np.random.default_rng()\nmu, sigma = 3., 1.  # mean and standard deviation\nx = rng.lognormal(mu, sigma, size=500)\n",
        "execution_status": "success",
        "out": ""
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nDisplay the histogram of the samples:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "fig, ax = plt.subplots()\n",
        "execution_status": "success",
        "out": ""
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "ax.hist(x, 50)\n",
        "execution_status": "failure",
        "out": "(array([95., 91., 75., 48., 43., 30., 27., 12., 16., 10.,  7.,  4.,  7.,\n        3.,  4.,  4.,  4.,  2.,  3.,  1.,  4.,  1.,  1.,  0.,  1.,  0.,\n        1.,  1.,  1.,  0.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,\n        0.,  0.,  0.,  0.,  0.,  1.,  0.,  1.,  0.,  0.,  1.]), array([  1.19764,   7.78864,  14.37964,  20.97064,  27.56165,  34.15265,\n        40.74365,  47.33465,  53.92565,  60.51665,  67.10765,  73.69865,\n        80.28966,  86.88066,  93.47166, 100.06266, 106.65366, 113.24466,\n       119.83566, 126.42666, 133.01766, 139.60867, 146.19967, 152.79067,\n       159.38167, 165.97267, 172.56367, 179.15467, 185.74567, 192.33668,\n       198.92768, 205.51868, 212.10968, 218.70068, 225.29168, 231.88268,\n       238.47368, 245.06469, 251.65569, 258.24669, 264.83769, 271.42869,\n       278.01969, 284.61069, 291.20169, 297.79269, 304.3837 , 310.9747 ,\n       317.5657 , 324.1567 , 330.7477 ]), <BarContainer object of 50 artists>)\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "plt.show()\n",
        "execution_status": "success",
        "out": ""
      },
      {
        "__type": "Figure",
        "__tag": 4024,
        "value": {
          "__type": "RefInfo",
          "__tag": 4000,
          "module": "scipy",
          "version": "1.18.0",
          "kind": "assets",
          "path": "fig-a2d085f7c02572dc.png"
        }
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nDisplay the histogram of the samples standardized by the classical zscore.\nDistribution is rescaled but its shape is unchanged.\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "fig, ax = plt.subplots()\n",
        "execution_status": "success",
        "out": ""
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "ax.hist(zscore(x), 50)\n",
        "execution_status": "failure",
        "out": "(array([95., 91., 75., 48., 43., 30., 27., 12., 16., 10.,  7.,  4.,  7.,\n        3.,  4.,  4.,  4.,  2.,  3.,  1.,  4.,  1.,  1.,  0.,  1.,  0.,\n        1.,  1.,  1.,  0.,  1.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,\n        0.,  0.,  0.,  0.,  0.,  1.,  0.,  1.,  0.,  0.,  1.]), array([-0.80714, -0.63481, -0.46249, -0.29017, -0.11785,  0.05447,\n        0.2268 ,  0.39912,  0.57144,  0.74376,  0.91609,  1.08841,\n        1.26073,  1.43305,  1.60537,  1.7777 ,  1.95002,  2.12234,\n        2.29466,  2.46699,  2.63931,  2.81163,  2.98395,  3.15627,\n        3.3286 ,  3.50092,  3.67324,  3.84556,  4.01789,  4.19021,\n        4.36253,  4.53485,  4.70717,  4.8795 ,  5.05182,  5.22414,\n        5.39646,  5.56879,  5.74111,  5.91343,  6.08575,  6.25807,\n        6.4304 ,  6.60272,  6.77504,  6.94736,  7.11969,  7.29201,\n        7.46433,  7.63665,  7.80897]), <BarContainer object of 50 artists>)\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "plt.show()\n",
        "execution_status": "success",
        "out": ""
      },
      {
        "__type": "Figure",
        "__tag": 4024,
        "value": {
          "__type": "RefInfo",
          "__tag": 4000,
          "module": "scipy",
          "version": "1.18.0",
          "kind": "assets",
          "path": "fig-1747c897e72b0165.png"
        }
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nDemonstrate that the distribution of geometric zscores is rescaled and\nquasinormal:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "fig, ax = plt.subplots()\n",
        "execution_status": "success",
        "out": ""
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "ax.hist(gzscore(x), 50)\n",
        "execution_status": "failure",
        "out": "(array([ 1.,  0.,  3.,  2.,  1.,  1.,  1.,  3.,  4.,  8.,  7., 11.,  7.,\n       10., 11., 15., 15., 14., 18., 14., 17., 23., 20., 24., 21., 24.,\n       15., 20., 23., 20., 21., 23., 14., 15., 11., 12.,  7.,  7.,  8.,\n        7.,  4.,  4.,  6.,  1.,  2.,  2.,  0.,  0.,  1.,  2.]), array([-2.79229, -2.68006, -2.56783, -2.45561, -2.34338, -2.23116,\n       -2.11893, -2.00671, -1.89448, -1.78226, -1.67003, -1.5578 ,\n       -1.44558, -1.33335, -1.22113, -1.1089 , -0.99668, -0.88445,\n       -0.77223, -0.66   , -0.54777, -0.43555, -0.32332, -0.2111 ,\n       -0.09887,  0.01335,  0.12558,  0.2378 ,  0.35003,  0.46226,\n        0.57448,  0.68671,  0.79893,  0.91116,  1.02338,  1.13561,\n        1.24783,  1.36006,  1.47229,  1.58451,  1.69674,  1.80896,\n        1.92119,  2.03341,  2.14564,  2.25786,  2.37009,  2.48232,\n        2.59454,  2.70677,  2.81899]), <BarContainer object of 50 artists>)\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "plt.show()\n",
        "execution_status": "success",
        "out": ""
      },
      {
        "__type": "Figure",
        "__tag": 4024,
        "value": {
          "__type": "RefInfo",
          "__tag": 4000,
          "module": "scipy",
          "version": "1.18.0",
          "kind": "assets",
          "path": "fig-e84d6cc8932367cd.png"
        }
      }
    ],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "gmean",
        "reference": {
          "__type": "LocalRef",
          "__tag": 4022,
          "kind": "module",
          "path": "scipy.stats._stats_py:gmean"
        },
        "kind": "module"
      },
      "descriptions": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Geometric mean"
            }
          ]
        }
      ],
      "type": "func"
    },
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "gstd",
        "reference": {
          "__type": "LocalRef",
          "__tag": 4022,
          "kind": "module",
          "path": "scipy.stats._stats_py:gstd"
        },
        "kind": "module"
      },
      "descriptions": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Geometric standard deviation"
            }
          ]
        }
      ],
      "type": "func"
    },
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "zscore",
        "reference": {
          "__type": "LocalRef",
          "__tag": 4022,
          "kind": "module",
          "path": "scipy.stats._stats_py:zscore"
        },
        "kind": "module"
      },
      "descriptions": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Standard score"
            }
          ]
        }
      ],
      "type": "func"
    }
  ],
  "signature": {
    "__type": "SignatureNode",
    "__tag": 4029,
    "kind": "function",
    "parameters": [
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "a",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "axis",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "KEYWORD_ONLY",
        "default": "0"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "ddof",
        "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"
      }
    ],
    "return_annotation": {
      "__type": "Empty",
      "__tag": 4031
    },
    "target_name": "gzscore"
  },
  "references": [
    ".. [1] \"Geometric standard score\", *Wikipedia*,",
    "       https://en.wikipedia.org/wiki/Geometric_standard_deviation#Geometric_standard_score."
  ],
  "qa": "scipy.stats._stats_py:gzscore",
  "arbitrary": [],
  "local_refs": [
    "a",
    "axis",
    "ddof",
    "gzscore",
    "nan_policy"
  ]
}