{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {
    "Notes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The probability density function for the t distribution is"
            }
          ]
        },
        {
          "__type": "Math",
          "__tag": 4058,
          "value": "P(x, df) = \\frac{\\Gamma(\\frac{df+1}{2})}{\\sqrt{\\pi df}\\Gamma(\\frac{df}{2})}\\Bigl( 1+\\frac{x^2}{df} \\Bigr)^{-(df+1)/2}"
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The t test is based on an assumption that the data come from a Normal distribution. The t test provides a way to test whether the sample mean (that is the mean calculated from the data) is a good estimate of the true mean."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "The derivation of the t-distribution was first published in 1908 by William Gosset while working for the Guinness Brewery in Dublin. Due to proprietary issues, he had to publish under a pseudonym, and so he used the name Student."
            }
          ]
        }
      ],
      "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": "out",
              "annotation": "ndarray or scalar",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Drawn samples from the parameterized standard Student's t distribution."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Draw samples from a standard Student's t distribution with "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "df"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " degrees of freedom."
            }
          ]
        }
      ],
      "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": "df",
              "annotation": "float or array_like of floats",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Degrees of freedom, must be > 0."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "DocParam",
              "__tag": 4016,
              "name": "size",
              "annotation": "int or tuple of ints, optional",
              "desc": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Output shape.  If the given shape is, e.g., "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "(m, n, k)"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": ", then "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "m * n * k"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " samples are drawn.  If size is "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "None"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " (default), a single value is returned if "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "df"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " is a scalar.  Otherwise, "
                    },
                    {
                      "__type": "InlineCode",
                      "__tag": 4051,
                      "value": "np.array(df).size"
                    },
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": " samples are drawn."
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "A special case of the hyperbolic distribution.  As "
            },
            {
              "__type": "ParamRef",
              "__tag": 4071,
              "name": "df"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": " gets large, the result resembles that of the standard normal distribution ("
            },
            {
              "__type": "CrossRef",
              "__tag": 4002,
              "value": "standard_normal",
              "reference": {
                "__type": "LocalRef",
                "__tag": 4022,
                "kind": "module",
                "path": "numpy.random:RandomState.standard_normal"
              },
              "kind": "module"
            },
            {
              "__type": "Text",
              "__tag": 4046,
              "value": ")."
            }
          ]
        },
        {
          "__type": "Admonition",
          "__tag": 4056,
          "kind": "note",
          "base_type": "note",
          "children": [
            {
              "__type": "AdmonitionTitle",
              "__tag": 4055,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "note "
                }
              ]
            },
            {
              "__type": "Paragraph",
              "__tag": 4045,
              "children": [
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": "New code should use the "
                },
                {
                  "__type": "CrossRef",
                  "__tag": 4002,
                  "value": "standard_t",
                  "reference": {
                    "__type": "RefInfo",
                    "__tag": 4000,
                    "module": "numpy",
                    "version": "*",
                    "kind": "api",
                    "path": "numpy.random._generator:Generator.standard_t"
                  },
                  "kind": "module"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": " method of a "
                },
                {
                  "__type": "CrossRef",
                  "__tag": 4002,
                  "value": "Generator",
                  "reference": {
                    "__type": "RefInfo",
                    "__tag": 4000,
                    "module": "numpy",
                    "version": "*",
                    "kind": "api",
                    "path": "numpy.random._generator:Generator"
                  },
                  "kind": "module"
                },
                {
                  "__type": "Text",
                  "__tag": 4046,
                  "value": " instance instead; please see the "
                },
                {
                  "__type": "InlineRole",
                  "__tag": 4003,
                  "value": "random-quick-start",
                  "domain": null,
                  "role": "ref",
                  "inventory": null
                },
                {
                  "__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": null,
  "item_line": null,
  "item_type": "cython_function_or_method",
  "aliases": [
    "numpy.random.standard_t",
    "numpy.random.RandomState.standard_t"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "From Dalgaard page 83 [1]_, suppose the daily energy intake for 11\nwomen in kilojoules (kJ) is:\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "intake = np.array([5260., 5470, 5640, 6180, 6390, 6515, 6805, 7515, \\\n                   7515, 8230, 8770])\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nDoes their energy intake deviate systematically from the recommended\nvalue of 7725 kJ? Our null hypothesis will be the absence of deviation,\nand the alternate hypothesis will be the presence of an effect that could be\neither positive or negative, hence making our test 2-tailed.\n\nBecause we are estimating the mean and we have N=11 values in our sample,\nwe have N-1=10 degrees of freedom. We set our significance level to 95% and\ncompute the t statistic using the empirical mean and empirical standard\ndeviation of our intake. We use a ddof of 1 to base the computation of our\nempirical standard deviation on an unbiased estimate of the variance (note:\nthe final estimate is not unbiased due to the concave nature of the square\nroot).\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "np.mean(intake)\nintake.std(ddof=1)\n",
        "execution_status": "failure"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "t = (np.mean(intake)-7725)/(intake.std(ddof=1)/np.sqrt(len(intake)))\n",
        "execution_status": "success"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "t\n",
        "execution_status": "failure"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nWe draw 1000000 samples from Student's t distribution with the adequate\ndegrees of freedom.\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "import matplotlib.pyplot as plt\ns = np.random.standard_t(10, size=1000000)\nh = plt.hist(s, bins=100, density=True)\n",
        "execution_status": "success"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nDoes our t statistic land in one of the two critical regions found at\nboth tails of the distribution?\n\n"
      },
      {
        "__type": "Code",
        "__tag": 4050,
        "value": "np.sum(np.abs(t) < np.abs(s)) / float(len(s))\n",
        "execution_status": "failure"
      },
      {
        "__type": "Text",
        "__tag": 4046,
        "value": "\nThe probability value for this 2-tailed test is about 1.83%, which is\nlower than the 5% pre-determined significance threshold.\n\nTherefore, the probability of observing values as extreme as our intake\nconditionally on the null hypothesis being true is too low, and we reject\nthe null hypothesis of no deviation."
      }
    ],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [
    {
      "__type": "SeeAlsoItem",
      "__tag": 4028,
      "name": {
        "__type": "CrossRef",
        "__tag": 4002,
        "value": "random.Generator.standard_t",
        "reference": {
          "__type": "RefInfo",
          "__tag": 4000,
          "module": "current-module",
          "version": "current-version",
          "kind": "to-resolve",
          "path": "random.Generator.standard_t"
        },
        "kind": "module"
      },
      "descriptions": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "which should be used for new code."
            }
          ]
        }
      ],
      "type": null
    }
  ],
  "signature": {
    "__type": "SignatureNode",
    "__tag": 4029,
    "kind": "function",
    "parameters": [
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "df",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": {
          "__type": "Empty",
          "__tag": 4031
        }
      },
      {
        "__type": "SigParam",
        "__tag": 4030,
        "name": "size",
        "annotation": {
          "__type": "Empty",
          "__tag": 4031
        },
        "kind": "POSITIONAL_OR_KEYWORD",
        "default": "None"
      }
    ],
    "return_annotation": {
      "__type": "Empty",
      "__tag": 4031
    },
    "target_name": "standard_t"
  },
  "references": [
    ".. [1] Dalgaard, Peter, \"Introductory Statistics With R\",",
    "       Springer, 2002.",
    ".. [2] Wikipedia, \"Student's t-distribution\"",
    "       https://en.wikipedia.org/wiki/Student's_t-distribution"
  ],
  "qa": "numpy.random:RandomState.standard_t",
  "arbitrary": [],
  "local_refs": [
    "df",
    "out",
    "size"
  ]
}