{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {
    "Notes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "A description of the process of MGC and applications on neuroscience data can be found in "
            },
            {
              "__type": "FootnoteReference",
              "__tag": 4066,
              "label": "1"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ". It is performed using the following steps:"
            }
          ]
        },
        {
          "__type": "BulletList",
          "__tag": 4053,
          "ordered": true,
          "start": 1,
          "children": [
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Two distance matrices "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "D^X"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "D^Y"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " are computed and    modified to be mean zero columnwise. This results in two    "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "n \\times n"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " distance matrices "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "A"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "B"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " (the    centering and unbiased modification) "
                    },
                    {
                      "__type": "FootnoteReference",
                      "__tag": 4066,
                      "label": "3"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "For all values "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "k"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "l"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " from "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "1, ..., n"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ","
                    }
                  ]
                },
                {
                  "__type": "BulletList",
                  "__tag": 4053,
                  "ordered": false,
                  "start": 1,
                  "children": [
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "The "
                            },
                            {
                              "__type": "InlineMath",
                              "__tag": 4057,
                              "value": "k"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "-nearest neighbor and "
                            },
                            {
                              "__type": "InlineMath",
                              "__tag": 4057,
                              "value": "l"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "-nearest neighbor graphs      are calculated for each property. Here, "
                            },
                            {
                              "__type": "InlineMath",
                              "__tag": 4057,
                              "value": "G_k (i, j)"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": " indicates      the "
                            },
                            {
                              "__type": "InlineMath",
                              "__tag": 4057,
                              "value": "k"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "-smallest values of the "
                            },
                            {
                              "__type": "InlineMath",
                              "__tag": 4057,
                              "value": "i"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "-th row of "
                            },
                            {
                              "__type": "InlineMath",
                              "__tag": 4057,
                              "value": "A"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "      and "
                            },
                            {
                              "__type": "InlineMath",
                              "__tag": 4057,
                              "value": "H_l (i, j)"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": " indicates the "
                            },
                            {
                              "__type": "InlineMath",
                              "__tag": 4057,
                              "value": "l"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": " smallested values of      the "
                            },
                            {
                              "__type": "InlineMath",
                              "__tag": 4057,
                              "value": "i"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "-th row of "
                            },
                            {
                              "__type": "InlineMath",
                              "__tag": 4057,
                              "value": "B"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "ListItem",
                      "__tag": 4054,
                      "children": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "Let "
                            },
                            {
                              "__type": "InlineMath",
                              "__tag": 4057,
                              "value": "\\circ"
                            },
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": " denotes the entry-wise matrix product, then local      correlations are summed and normalized using the following statistic:"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "__type": "Math",
          "__tag": 4058,
          "value": "c^{kl} = \\frac{\\sum_{ij} A G_k B H_l}\n              {\\sqrt{\\sum_{ij} A^2 G_k \\times \\sum_{ij} B^2 H_l}}"
        },
        {
          "__type": "BulletList",
          "__tag": 4053,
          "ordered": true,
          "start": 1,
          "children": [
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The MGC test statistic is the smoothed optimal local correlation of    "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "\\{ c^{kl} \\}"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". Denote the smoothing operation as "
                    },
                    {
                      "__type": "InlineMath",
                      "__tag": 4057,
                      "value": "R(\\cdot)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "    (which essentially set all isolated large correlations) as 0 and    connected large correlations the same as before, see "
                    },
                    {
                      "__type": "FootnoteReference",
                      "__tag": 4066,
                      "label": "3"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ".) MGC is,"
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "__type": "Math",
          "__tag": 4058,
          "value": "MGC_n (x, y) = \\max_{(k, l)} R \\left(c^{kl} \\left( x_n, y_n \\right)\n                                            \\right)"
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The test statistic returns a value between "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "(-1, 1)"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " since it is normalized."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The p-value returned is calculated using a permutation test. This process is completed by first randomly permuting "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "y"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " to estimate the null distribution and then calculating the probability of observing a test statistic, under the null, at least as extreme as the observed test statistic."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "MGC requires at least 5 samples to run with reliable results. It can also handle high-dimensional data sets. In addition, by manipulating the input data matrices, the two-sample testing problem can be reduced to the independence testing problem "
            },
            {
              "__type": "FootnoteReference",
              "__tag": 4066,
              "label": "4"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ". Given sample data "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "U"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "V"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " of sizes "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "p \\times n"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "p \\times m"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ", data matrix "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "X"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " and "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "Y"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " can be created as follows:"
            }
          ]
        },
        {
          "__type": "Math",
          "__tag": 4058,
          "value": "X = [U | V] \\in \\mathcal{R}^{p \\times (n + m)}\nY = [0_{1 \\times n} | 1_{1 \\times m}] \\in \\mathcal{R}^{(n + m)}"
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Then, the MGC statistic can be calculated as normal. This methodology can be extended to similar tests such as distance correlation "
            },
            {
              "__type": "FootnoteReference",
              "__tag": 4066,
              "label": "4"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "."
            }
          ]
        },
        {
          "__type": "Admonition",
          "__tag": 4056,
          "kind": "versionadded",
          "base_type": "neutral",
          "children": [
            {
              "__type": "AdmonitionTitle",
              "__tag": 4055,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "versionadded 1.4.0"
                }
              ]
            }
          ]
        },
        {
          "__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": "multiscale_graphcorr",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "module",
                "path": "scipy.stats._mgc:multiscale_graphcorr"
              },
              "kind": "module"
            },
            {
              "__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
        },
        {
          "__type": "Blockquote",
          "__tag": 4059,
          "children": [
            {
              "__type": "Paragraph",
              "__tag": 4045,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "See "
                },
                {
                  "__type": "InlineRole",
                  "__tag": 4003,
                  "value": "dev-arrayapi",
                  "domain": null,
                  "role": "ref",
                  "inventory": null
                },
                {
                  "__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": "res",
              "annotation": "MGCResult",
              "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": "statistic"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__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": "pvalue"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "__type": "DefListItem",
                      "__tag": 4037,
                      "dt": {
                        "__type": "Paragraph",
                        "__tag": 4045,
                        "children": [
                          {
                            "__type": "Text",
                            "__tag": 4046,
                            "value": "mgc_dict"
                          }
                        ]
                      },
                      "dd": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "mgc_dict"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Computes the Multiscale Graph Correlation (MGC) test statistic."
            }
          ]
        }
      ],
      "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, y",
              "annotation": "ndarray",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "If "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "x"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "y"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " have shapes "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(n, p)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(n, q)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " where "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "n",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is the number of samples and "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "p",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "q",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " are the number of dimensions, then the MGC independence test will be run.  Alternatively, "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "x"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "y"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " can have shapes "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(n, n)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " if they are distance or similarity matrices, and "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "compute_distance"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " must be sent to "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "None"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". If "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "x"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "y"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " have shapes "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(n, p)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(m, p)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", an unpaired two-sample MGC test will be run."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "compute_distance",
              "annotation": "callable, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "A function that computes the distance or similarity among the samples within each data matrix. Set to "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "None"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " if "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "x"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "y"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " are already distance matrices. The default uses the euclidean norm metric. If you are calling a custom function, either create the distance matrix before-hand or create a function of the form "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "compute_distance(x)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " where "
                    },
                    {
                      "__type": "ParamRef",
                      "__tag": 4071,
                      "name": "x"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is the data matrix for which pairwise distances are calculated."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "reps",
              "annotation": "int, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "The number of replications used to estimate the null when using the permutation test. The default is "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "1000"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "workers",
              "annotation": "int or map-like callable, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "If "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "workers"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is an int the population is subdivided into "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "workers"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " sections and evaluated in parallel (uses "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "multiprocessing.Pool <multiprocessing>"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "). Supply "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "-1"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " to use all cores available to the Process. Alternatively supply a map-like callable, such as "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "multiprocessing.Pool.map"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " for evaluating the p-value in parallel. This evaluation is carried out as "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "workers(func, iterable)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". Requires that "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "func",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " be pickleable. The default is "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "1"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "is_twosamp",
              "annotation": "bool, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "If "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "True",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", a two sample test will be run. If "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "x"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "y"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " have shapes "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(n, p)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(m, p)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", this optional will be overridden and set to "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "True"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". Set to "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "True"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " if "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "x"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "y"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " both have shapes "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(n, p)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " and a two sample test is desired. The default is "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "False"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". Note that this will not run if inputs are distance matrices."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "random_state",
              "annotation": "{None, int, `numpy.random.Generator`,",
              "desc": [
                {
                  "__type": "Blockquote",
                  "__tag": 4059,
                  "children": [
                    {
                      "__type": "Paragraph",
                      "__tag": 4045,
                      "children": [
                        {
                          "__type": "CrossRef",
                          "__tag": 4002,
                          "value": "numpy.random.RandomState",
                          "reference": {
                            "__type": "RefInfo",
                            "__tag": 4000,
                            "module": "numpy",
                            "version": "*",
                            "kind": "api",
                            "path": "numpy.random.mtrand:RandomState"
                          },
                          "kind": "module"
                        },
                        {
                          "__type": "Text",
                          "__tag": 4046,
                          "value": "}, optional"
                        }
                      ]
                    }
                  ]
                },
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "If "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "seed",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is None (or "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "np.random",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "), the "
                    },
                    {
                      "__type": "CrossRef",
                      "__tag": 4002,
                      "value": "numpy.random.RandomState",
                      "reference": {
                        "__type": "RefInfo",
                        "__tag": 4000,
                        "module": "numpy",
                        "version": "*",
                        "kind": "api",
                        "path": "numpy.random.mtrand:RandomState"
                      },
                      "kind": "module"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " singleton is used. If "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "seed",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is an int, a new "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "RandomState"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " instance is used, seeded with "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "seed",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ". If "
                    },
                    {
                      "__type": "InlineRole",
                      "__tag": 4003,
                      "value": "seed",
                      "domain": null,
                      "role": null,
                      "inventory": null
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is already a "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "Generator"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " or "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "RandomState"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " instance then that instance is used."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Specifically, for each point, MGC finds the "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "k"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "-nearest neighbors for one property (e.g. cloud density), and the "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "l"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "-nearest neighbors for the other property (e.g. grass wetness) "
            },
            {
              "__type": "FootnoteReference",
              "__tag": 4066,
              "label": "1"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ". This pair "
            },
            {
              "__type": "InlineMath",
              "__tag": 4057,
              "value": "(k, l)"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " is called the \"scale\". A priori, however, it is not know which scales will be most informative. So, MGC computes all distance pairs, and then efficiently computes the distance correlations for all scales. The local correlations illustrate which scales are relatively informative about the relationship. The key, therefore, to successfully discover and decipher relationships between disparate data modalities is to adaptively determine which scales are the most informative, and the geometric implication for the most informative scales. Doing so not only provides an estimate of whether the modalities are related, but also provides insight into how the determination was made. This is especially important in high-dimensional data, where simple visualizations do not reveal relationships to the unaided human eye. Characterizations of this implementation in particular have been derived from and benchmarked within in "
            },
            {
              "__type": "FootnoteReference",
              "__tag": 4066,
              "label": "2"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "."
            }
          ]
        }
      ],
      "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/_mgc.py",
  "item_line": 99,
  "item_type": "function",
  "aliases": [
    "scipy.stats.multiscale_graphcorr"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "import numpy as np\nfrom scipy.stats import multiscale_graphcorr\nx = np.arange(100)\ny = x\nres = multiscale_graphcorr(x, y)\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "res.statistic, res.pvalue\n",
        "execution_status": "failure"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nTo run an unpaired two-sample test,\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "x = np.arange(100)\ny = np.arange(79)\nres = multiscale_graphcorr(x, y)\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nor, if shape of the inputs are the same,\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "x = np.arange(100)\ny = x\nres = multiscale_graphcorr(x, y, is_twosamp=True)\n",
        "execution_status": "success"
      }
    ],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "kendalltau",
        "reference": {
          "__type": "RefInfo",
          "__tag": 4000,
          "module": "current-module",
          "version": "current-version",
          "kind": "to-resolve",
          "path": "kendalltau"
        },
        "kind": "module"
      },
      "descriptions": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Calculates Kendall's tau."
            }
          ]
        }
      ],
      "type": "func"
    },
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "pearsonr",
        "reference": {
          "__type": "RefInfo",
          "__tag": 4000,
          "module": "current-module",
          "version": "current-version",
          "kind": "to-resolve",
          "path": "pearsonr"
        },
        "kind": "module"
      },
      "descriptions": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Pearson correlation coefficient and p-value for testing non-correlation."
            }
          ]
        }
      ],
      "type": "func"
    },
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "spearmanr",
        "reference": {
          "__type": "RefInfo",
          "__tag": 4000,
          "module": "current-module",
          "version": "current-version",
          "kind": "to-resolve",
          "path": "spearmanr"
        },
        "kind": "module"
      },
      "descriptions": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Calculates a Spearman rank-order correlation coefficient."
            }
          ]
        }
      ],
      "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": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "compute_distance",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "<function _euclidean_dist at 0x0000>"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "reps",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "1000"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "workers",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "1"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "is_twosamp",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "False"
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "random_state",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "None"
      }
    ],
    "return_annotation": {
      "__type": "Empty",
      "__tag": 4031
    },
    "target_name": "multiscale_graphcorr"
  },
  "references": [
    ".. [1] Vogelstein, J. T., Bridgeford, E. W., Wang, Q., Priebe, C. E.,",
    "       Maggioni, M., & Shen, C. (2019). Discovering and deciphering",
    "       relationships across disparate data modalities. ELife.",
    ".. [2] Panda, S., Palaniappan, S., Xiong, J., Swaminathan, A.,",
    "       Ramachandran, S., Bridgeford, E. W., ... Vogelstein, J. T. (2019).",
    "       mgcpy: A Comprehensive High Dimensional Independence Testing Python",
    "       Package. :arXiv:`1907.02088`",
    ".. [3] Shen, C., Priebe, C.E., & Vogelstein, J. T. (2019). From distance",
    "       correlation to multiscale graph correlation. Journal of the American",
    "       Statistical Association.",
    ".. [4] Shen, C. & Vogelstein, J. T. (2018). The Exact Equivalence of",
    "       Distance and Kernel Methods for Hypothesis Testing.",
    "       :arXiv:`1806.05514`"
  ],
  "qa": "scipy.stats._mgc:multiscale_graphcorr",
  "arbitrary": [],
  "local_refs": [
    "compute_distance",
    "is_twosamp",
    "random_state",
    "reps",
    "res",
    "workers",
    "x",
    "y"
  ]
}