scipy.stats.mstats.

sem#

scipy.stats.mstats.sem(a, axis=0, ddof=1)[source]#

計算輸入陣列均值的標準誤。

有時也稱為測量標準誤。

參數:
aarray_like

包含要傳回標準誤之值的陣列。

axisint 或 None,可選

如果 axis 為 None,則先將 a 展平。如果 axis 為整數,則這將是運算的軸。預設值為 0。

ddofint,可選

自由度差值。相對於母體變異數估計值,在有限樣本中調整偏差的自由度數量。預設值為 1。

回傳:
sndarray 或 float

樣本中均值的標準誤,沿著輸入軸。

註解

ddof 的預設值在 scipy 0.15.0 中已變更,以與 scipy.stats.sem 以及最常用的定義(如 R 文件中)保持一致。

範例

沿著第一個軸尋找標準誤

>>> import numpy as np
>>> from scipy import stats
>>> a = np.arange(20).reshape(5,4)
>>> print(stats.mstats.sem(a))
[2.8284271247461903 2.8284271247461903 2.8284271247461903
 2.8284271247461903]

使用 n 個自由度在整個陣列中尋找標準誤

>>> print(stats.mstats.sem(a, axis=None, ddof=0))
1.2893796958227628