数据变换+正态检验

非正态分布-->正态:

在将非正态分布的数据转换为正态分布的数据时,首先根据偏度、峰度等情况进行判断,不同的情况可以使用对数、开根号等转换方法:

http://blog.sina.com.cn/s/blog_13ec735f50102x59u.html

 https://www.cnblogs.com/minks/p/6259883.html

http://blog.sina.com.cn/s/blog_751bd9440102vy6j.html

python-检验33品种数据是否是正态分布———————https://blog.csdn.net/qq_26948675/article/details/73648910(根据样本数选择合适的检验分布方法);http://blog.sina.com.cn/s/blog_80828ce00101oiso.html

matlab判断是否服从正态分布:https://wenku.baidu.com/view/035d6bfadd3383c4bb4cd291.html

判断数据是否服从正态分布方法:

https://blog.csdn.net/QimaoRyan/article/details/72861387  CSDN方法

https://wenku.baidu.com/view/043521325a8102d276a22f51.html

****************https://www.cnblogs.com/webRobot/p/6760839.html************

# -*- coding: utf-8 -*-
'''
Author:Toby
QQ:231469242,all right reversed,no commercial use
 
'''
 
import scipy
from scipy.stats import f
import numpy as np
import matplotlib.pyplot as plt
import scipy.stats as stats
# additional packages
from statsmodels.stats.diagnostic import lillifors
 
group1=[2,3,7,2,6]
group2=[10,8,7,5,10]
group3=[10,13,14,13,15]
list_groups=[group1,group2,group3]
list_total=group1+group2+group3
 
 
#正态分布测试
def check_normality(testData):
    #20<样本数<50用normal test算法检验正态分布性
    if 20<len(testData) <50:
       p_value= stats.normaltest(testData)[1]
       if p_value<0.05:
           print"use normaltest"
           print "data are not normal distributed"
           return  False
       else:
           print"use normaltest"
           print "data are normal distributed"
           return True
     
    #样本数小于50用Shapiro-Wilk算法检验正态分布性
    if len(testData) <50:
       p_value= stats.shapiro(testData)[1]
       if p_value<0.05:
           print "use shapiro:"
           print "data are not normal distributed"
           return  False
       else:
           print "use shapiro:"
           print "data are normal distributed"
           return True
       
    if 300>=len(testData) >=50:
       p_value= lillifors(testData)[1]
       if p_value<0.05:
           print "use lillifors:"
           print "data are not normal distributed"
           return  False
       else:
           print "use lillifors:"
           print "data are normal distributed"
           return True
     
    if len(testData) >300
       p_value= stats.kstest(testData,'norm')[1]
       if p_value<0.05:
           print "use kstest:"
           print "data are not normal distributed"
           return  False
       else:
           print "use kstest:"
           print "data are normal distributed"
           return True
 
 
#对所有样本组进行正态性检验
def NormalTest(list_groups):
    for group in list_groups:
        #正态性检验
        status=check_normality(group1)
        if status==False :
            return False
             
     
#对所有样本组进行正态性检验   
NormalTest(list_groups)
原文地址:https://www.cnblogs.com/eternallql/p/8915934.html