// 正态分布检验
//NormalTest:正态分布检验
//ZF:正态分布累积函数
//varK(dList,k):k阶样本矩
int NormalTest(double* dList,int nDataCount,double alpha,bool* pbRes)
{
double sig1,sig2,mu2,A1,A2,A3,A4,B2,B3,B4,g1,g2,u1,u2;
if((NULL == dList) || (NULL == pnRes)) return -1;
if(nDataCount<100) return -2;
if((alpha < 0) || (alpha >= 1.0) ) return -3;
sig1=sqrt(6.0*(n-2)/(n+1)/(n+3));
sig2=sqrt(24.0*n*(n-2)*(n-3)/(n+1)/(n+1)/(n+3)/(n+5));
mu2=3.0-6.0/(n+1);
A1=varK(dList,1);
A2=varK(dList,2);
A3=varK(dList,3);
A4=varK(dList,4);
B2=A2-A1*A1;
B3=A3-3.0*A2*A1+2.0*A1*A1*A1;
B4=A4-4.0*A3*A1+6.0*A2*A1*A1-3.0*A1*A1*A1*A1;
if(fabs(B2)<1e-9)
return -4;
g1=B3/B2/sqrt(B2);
g2=B4/B2/B2;
u1=g1/sig1;
u2=(g2-mu2)/sig2;
if( (fabs(u1) >= ZF(alpha/4.0)) || (fabs(u2) >= ZF(alpha/4.0)) )
{
*pbRes = false;
}
else
{
*pbRes = true;
}
return 1;
}