📜  设置并运行两个样本的独立 t 检验 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:18.488000             🧑  作者: Mango

代码示例1
# Import the libraries
import numpy as np
from scipy import stats
np.random.seed(42)

# Generate the random variables with the specified mean, std, and sample size
rvs1 = stats.norm.rvs(loc=5, scale=10,size=500)
rvs2 = stats.norm.rvs(loc=5, scale=20, size=500)

# Calculate the t statistic for these two sample populations
stats.ttest_ind(rvs1, rvs2)