检验是否为正态分布
使用 # Scipy Normaltest how is it used?
image.png平均值差异检验
代码示例如下
from scipy.stats import kstest, ttest_ind, levene
# data analysis
print("\n--------- 检验是否为正态分布 ---------")
print(kstest(df_user_fluency['sub_new_list_fluency'], 'norm'))
print(kstest(df_user_fluency['total_new_list_fluency'], 'norm'))
print(kstest(df_user_fluency['sub_fluency'], 'norm'))
print(kstest(df_user_fluency['total_fluency'], 'norm'))
print("\n--------- 检验方差齐性 ---------")
print(levene(df_user_fluency['sub_new_list_fluency'], df_user_fluency['total_new_list_fluency']))
print(levene(df_user_fluency['sub_fluency'], df_user_fluency['total_fluency']))
print("\n--------- 平均值差异性检验 ---------")
print(ttest_ind(df_user_fluency['sub_new_list_fluency'], df_user_fluency['total_new_list_fluency'], equal_var=False))
print(ttest_ind(df_user_fluency['sub_fluency'], df_user_fluency['total_fluency'], equal_var=True))
网友评论