//计算类publicclassCaculation{//计算类方法:求ArrayList平均值//doubleAverage(ArrayList数据列表)publicstaticdoubleAverage(ArrayListlist){doubleaverageTemp=0;foreach(objectlistObjectinlist){averageTemp+=(double)listObject;}averageTemp/=list.Count;returnaverageTemp;}//计算类方法:求ArrayList标准误差估计值//doubleError(ArrayList数据列表)publicstaticdoubleError(ArrayListlist){doubleaverageTemp=Average(list),SquareSumTemp=0,Error=0;foreach(objectlistObjectinlist){SquareSumTemp+=(double)listObject*(double)listObject;}Error=SquareSumTemp-list.Count*averageTemp*averageTemp;Error/=list.Count-1;Error=Math.Sqrt(Error);returnError;}//计算类方法:求ArrayList残差//ArrayListCalcResidualError(ArrayList数据列表)publicstaticArrayListCalcResidualError(ArrayListlist){ArrayListResidualListTemp=newArrayList();foreach(objectlistObjectinlist){ResidualListTemp.Add((double)listObject-Caculation.Average(list));}returnResidualListTemp;}}//系统误差类publicclassCalcSystemicError{//系统误差类方法:累进性系统误差(马里科夫准则)//boolMalikovCriterion(ArrayList残差列表)publicstaticboolMalikovCriterion(ArrayListresidualList){ArrayListListTemp=newArrayList();doubleMaxResidual=0,MalikovResidual=0,index=1;foreach(objectlistObjectinresidualList){ListTemp.Add(Math.Abs((double)listObject));if(index=residualList.Count/2)MalikovResidual+=(double)listObject;elseMalikovResidual-=(double)listObject;index++;}ListTemp.Sort();MaxResidual=(double)ListTemp[ListTemp.Count-1];if(Math.Abs(MalikovResidual)MaxResidual)returnfalse;elsereturntrue;}//系统误差类方法:周期性系统误差(阿贝-赫梅特准则)//boolAbbeHelmertCriterion(ArrayList残差列表,double标准误差估计值)publicstaticboolAbbeHelmertCriterion(ArrayListresidualList,doubleerror){doubleCalcTemp=0;for(intindex=0;indexresidualList.Count-1;index++){CalcTemp+=(double)residualList[index]*(double)residualList[index+1];}CalcTemp=Math.Abs(CalcTemp);if(CalcTempMath.Sqrt(residualList.Count-1)*error*error)returntrue;elsereturnfalse;}}//检验准则类,所有准则每次只剔去偏离最大的一个坏值,返回的是数组中的位置加1(返回是0则为无坏值)publicclassCriterion{//检验准则类方法:莱特准则//intLetts(ArrayList残差列表,double标准误差估计值)publicstaticintLetts(ArrayListresidualList,doubleError){intreturnindex=0,index=0;doubleErrorComp;if(residualList.Count10){MessageBox.Show(数据量小于10不适合使用莱特检验法!);return0;}else{ErrorComp=3*Error;foreach(objectlistObjectinresidualList){index++;if(Math.Abs((double)listObject)ErrorComp){returnindex=index;ErrorComp=Math.Abs((double)listObject);}}returnreturnindex;}}//检验准则类方法:查肖维纳准则表得ch//doubleta_get(int数据长度)staticdoublech_get(intn)//肖维纳准则表{switch(n){case5:return1.65;case16:return2.16;case27:return2.35;case6:return1.73;case17:return2.18;case28:return2.37;case7:return1.79;case18:return2.20;case29:return2.38;case8:return1.86;case19:return2.22;case30:return2.39;case9:return1.92;case20:return2.24;case31:return2.45;case10:return1.96;case21:return2.26;case32:return2.50;case11:return2.00;case22:return2.28;case33:return2.58;case12:return2.04;case23:return2.30;case34:return2.64;case13:return2.07;case24:return2.32;case35:return2.74;case14:return2.10;case25:return2.33;case36:return2.81;case15:return2.13;case26:return2.34;case37:return3.02;default:return0;}}//检验准则类方法:肖维纳准则//intChauvenet(ArrayList残差列表,double标准误差估计值)publicstaticintChauvenet(ArrayListresidualList,doubleError){intreturnindex=0,index=0;doubleErrorComp;if(residualList.Count5){MessageBox.Show(数据量小于5不适合使用肖维纳检验法!);return0;}else{ErrorComp=ch_get(residualList.Count)*Error;foreach(objectlistObjectinresidualList){index++;if(Math.Abs((double)listObject)ErrorComp){returnindex=index;ErrorComp=Math.Abs((double)listObject);}}returnreturnindex;}}//检验准则类方法:查t分布在对称区间的积分表得t//doubleta_get(string置信概率(0.95或0.99),int数据长度)staticdoubleta_get(stringp,intk)//t分布在对称区间的积分表{if(p==0.95){switch(k){case1:return12.706;case11:return2.201;case21:return2.080;case31:return2.040;case2:return4.303;case12:return2.179;case22:return2.074;case32:return2.037;case3:return3.182;case13:return2.160;case23:return2.069;case33:return2.035;case4:return2.776;case14:return2.145;case24:return2.064;case34:return2.032;case5:return2.571;case15:return2.131;case25:return2.060;case35:return2.030;case6:return2.447;case16:return2.120;case26:return2.056;case36:return2.028;case7:return2.365;case17:return2.110;case27:return2.052;case37:return2.026;case8:return2.306;case18:return2.101;case28:return2.048;case38:return2.024;case9:return2.262;case19:return2.093;case29:return2.045;case39:return2.023;case10:return2.228;case20:return2.086;case30:return2.042;case40:return2.021;default:return0;}}elseif(p==0.99){switch(k){case1:return63.657;case11:return3.106;case21:return2.831;case31:return2.744;case2:return9.925;case12:return3.055;case22:return2.819;case32:return2.738;case3:return5.841;case13:return3.012;case23:return2.807;case33:return2.733;case4:return4.604;case14:return2.977;case24:return2.797;case34:return2.728;case5:return4.032;case15:return2.947;case25:return2.787;case35:return2.724;case6:return3.707;case16:return2.921;case26:return2.779;case36:return2.719;case7:return3.499;case17:return2.898;case27:return2.771;case37:return2.715;case8:return3.355;case18:return2.878;case28:return2.763;case38:return2.7