_覓 | 覦覈襦 | 豕蠏手 | 殊螳 | 譯殊碁 |
FrontPage › Python-T-test
|
|
[edit]
1 one-sample #覈(蠏)襯 螻 蟆曙 sample 蠏螻 覈(蠏) 螳讌/るジ讌襯 蟆
import numpy as np import scipy as sp #random number N = 100 mu = 100 sd = 10 np.random.seed(0) x = np.random.normal(mu, sd, N) #histogram import seaborn as sns sns.distplot(x, kde=False, fit=sp.stats.norm) plt.show() #t-test: 1-sample sp.stats.ttest_1samp(x, popmean=100) #覈 蠏 100企朱 蟆 螻 蟆曙 蟆郁骸
[edit]
2 two-sample # sample 覿一 螳 蟆曙
#two-sample t-test: 覿一 螳 蟆曙 import numpy as np import scipy as sp np.random.seed(0) x1 = np.random.normal(100, 10, 100) x2 = np.random.normal(97, 10, 100) sns.distplot(x1, kde=False, fit=sp.stats.norm) sns.distplot(x2, kde=False, fit=sp.stats.norm) plt.show() sp.stats.ttest_ind(x1, x2, equal_var=True) 蟆郁骸
sample 覿一 るジ 蟆曙
#two-sample t-test: 覿一 るジ 蟆曙 import numpy as np import scipy as sp np.random.seed(0) x1 = np.random.normal(100, 10, 100) x2 = np.random.normal(97, 5, 100) sns.distplot(x1, kde=False, fit=sp.stats.norm) sns.distplot(x2, kde=False, fit=sp.stats.norm) plt.show() sp.stats.ttest_ind(x1, x2, equal_var=False) 蟆郁骸
[edit]
3 paired two-sample ##two-sample t-test: 覲 import numpy as np import scipy as sp np.random.seed(0) x1 = np.random.normal(100, 10, 100) x2 = np.random.normal(97, 10, 100) sns.distplot(x1, kde=False, fit=sp.stats.norm) sns.distplot(x2, kde=False, fit=sp.stats.norm) plt.show() sp.stats.ttest_rel(x1, x2) 蟆郁骸
鏤
|
企 蠍一 至鍵覲企 至鍵 狩 蟆覲企 豈 ろ蠍 狩 蟆訖企. |