方法
random.Generator.
chisquare
从卡方分布中提取样本。
什么时候? df 独立随机变量,每一个都有标准正态分布(平均值0,方差1),是平方和总和,得到的分布是卡方分布(见注释)。这种分布通常用于假设检验。
自由度数必须大于0。
输出形状。如果给定的形状是,例如, (m, n, k) 然后 m * n * k 取样。如果尺寸是 None (默认),如果 df 是标量。否则, np.array(df).size 取样。
(m, n, k)
m * n * k
None
df
np.array(df).size
从参数化卡方分布中提取样本。
什么时候? df <=0或当 size (例如) size=-1 )。
size=-1
笔记
通过平方和得到的变量 df 独立的标准正态分布随机变量:
卡方分布,表示
卡方分布的概率密度函数是
System Message: WARNING/2 (p(x)=\frac{(1/2)^{k/2}}{\Gamma(k/2)})
latex exited with error [stdout] This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2019/dev/Debian) (preloaded format=latex) restricted \write18 enabled. entering extended mode (./math.tex LaTeX2e <2018-12-01> (/usr/share/texlive/texmf-dist/tex/latex/base/article.cls Document Class: article 2018/09/03 v1.4i Standard LaTeX document class (/usr/share/texlive/texmf-dist/tex/latex/base/size12.clo)) (/usr/share/texlive/texmf-dist/tex/latex/base/inputenc.sty) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?' option. (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amstext.sty (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsgen.sty)) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsbsy.sty) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsopn.sty)) (/usr/share/texlive/texmf-dist/tex/latex/amscls/amsthm.sty) (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amssymb.sty (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amsfonts.sty)) (/usr/share/texlive/texmf-dist/tex/latex/anyfontsize/anyfontsize.sty) (/usr/share/texlive/texmf-dist/tex/latex/tools/bm.sty) (./math.aux) (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsa.fd) (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsb.fd) ! Package inputenc Error: Unicode character ( (U+FF08) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ...�1/2)^{k/2}}{\Gamma(k/2)}\end{split} ! Package inputenc Error: Unicode character ) (U+FF09) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ...�1/2)^{k/2}}{\Gamma(k/2)}\end{split} ! Package inputenc Error: Unicode character ( (U+FF08) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ...�1/2)^{k/2}}{\Gamma(k/2)}\end{split} ! Package inputenc Error: Unicode character ) (U+FF09) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ...�1/2)^{k/2}}{\Gamma(k/2)}\end{split} ! Package inputenc Error: Unicode character ( (U+FF08) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ...�1/2)^{k/2}}{\Gamma(k/2)}\end{split} ! Package inputenc Error: Unicode character ) (U+FF09) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ...�1/2)^{k/2}}{\Gamma(k/2)}\end{split} ! Package inputenc Error: Unicode character ( (U+FF08) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ...�1/2)^{k/2}}{\Gamma(k/2)}\end{split} ! Package inputenc Error: Unicode character ) (U+FF09) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ...�1/2)^{k/2}}{\Gamma(k/2)}\end{split} ! Package inputenc Error: Unicode character ( (U+FF08) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ...�1/2)^{k/2}}{\Gamma(k/2)}\end{split} ! Package inputenc Error: Unicode character ) (U+FF09) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ...�1/2)^{k/2}}{\Gamma(k/2)}\end{split} ! Package inputenc Error: Unicode character ( (U+FF08) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ...�1/2)^{k/2}}{\Gamma(k/2)}\end{split} ! Package inputenc Error: Unicode character ) (U+FF09) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ...�1/2)^{k/2}}{\Gamma(k/2)}\end{split} [1] (./math.aux) ) (see the transcript file for additional information) Output written on math.dvi (1 page, 440 bytes). Transcript written on math.log.
在哪里? 是伽玛函数,
System Message: WARNING/2 (\伽玛(x)=\int-\infty t x-1 e-t dt.)
latex exited with error [stdout] This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2019/dev/Debian) (preloaded format=latex) restricted \write18 enabled. entering extended mode (./math.tex LaTeX2e <2018-12-01> (/usr/share/texlive/texmf-dist/tex/latex/base/article.cls Document Class: article 2018/09/03 v1.4i Standard LaTeX document class (/usr/share/texlive/texmf-dist/tex/latex/base/size12.clo)) (/usr/share/texlive/texmf-dist/tex/latex/base/inputenc.sty) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?' option. (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amstext.sty (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsgen.sty)) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsbsy.sty) (/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsopn.sty)) (/usr/share/texlive/texmf-dist/tex/latex/amscls/amsthm.sty) (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amssymb.sty (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amsfonts.sty)) (/usr/share/texlive/texmf-dist/tex/latex/anyfontsize/anyfontsize.sty) (/usr/share/texlive/texmf-dist/tex/latex/tools/bm.sty) (./math.aux) (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsa.fd) (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsb.fd) ! Undefined control sequence. <argument> \split@tag \begin {split}\� ��玛(x)=\int -\infty t x-1 e-t dt... l.14 ...�x)=\int-\infty t x-1 e-t dt.\end{split} ! Package inputenc Error: Invalid UTF-8 byte "BC. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ...�x)=\int-\infty t x-1 e-t dt.\end{split} ! Package inputenc Error: Invalid UTF-8 byte "BD. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ...�x)=\int-\infty t x-1 e-t dt.\end{split} ! Package inputenc Error: Unicode character 玛 (U+739B) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ...�x)=\int-\infty t x-1 e-t dt.\end{split} ! Package inputenc Error: Unicode character ( (U+FF08) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ...�x)=\int-\infty t x-1 e-t dt.\end{split} ! Package inputenc Error: Unicode character ) (U+FF09) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ...�x)=\int-\infty t x-1 e-t dt.\end{split} ! Undefined control sequence. <argument> \split@tag \begin {split}\� ��玛(x)=\int -\infty t x-1 e-t dt... l.14 ...�x)=\int-\infty t x-1 e-t dt.\end{split} ! Package inputenc Error: Invalid UTF-8 byte "BC. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ...�x)=\int-\infty t x-1 e-t dt.\end{split} ! Package inputenc Error: Invalid UTF-8 byte "BD. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ...�x)=\int-\infty t x-1 e-t dt.\end{split} ! Package inputenc Error: Unicode character 玛 (U+739B) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ...�x)=\int-\infty t x-1 e-t dt.\end{split} ! Package inputenc Error: Unicode character ( (U+FF08) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ...�x)=\int-\infty t x-1 e-t dt.\end{split} ! Package inputenc Error: Unicode character ) (U+FF09) (inputenc) not set up for use with LaTeX. See the inputenc package documentation for explanation. Type H <return> for immediate help. ... l.14 ...�x)=\int-\infty t x-1 e-t dt.\end{split} [1] (./math.aux) ) (see the transcript file for additional information) Output written on math.dvi (1 page, 412 bytes). Transcript written on math.log.
工具书类
NIST“工程统计手册”https://www.itl.nist.gov/div898/handbook/eda/section3/eda3666.htm
实例
>>> np.random.default_rng().chisquare(2,4) array([ 1.89920014, 9.00867716, 3.13710533, 5.62318272]) # random