Dim nindex As Long
Dim indexNAME(20) As String
Dim indexMAX(20) As Long
Dim indexORDER(20, 20) As String
Dim nsample As Long
Dim indextable(20, 500) As Integer
Dim currentROW As Long ''' 迭代的最大次数
Const EULER =
Const FPMIN = 1E-30 ''' 为防止除0使用的常数
''' 加分析基本统计参数,不能应用复杂统计程序求解,以减少计算时间及程序复杂性
Sub basestat(index() As Integer, X() As Double, ByVal N As Integer, ByVal NK As Integer, _
AVEI() As Double, NI() As Integer, SEI2() As Double, mini() As Double, maxi() As Double, _
ave As Double, se2 As Double, min As Double, max As Double)
Dim I As Integer, J As Integer
ReDim SUMi2(NK) As Double, SUMI(NK) As Double
Dim SUM As Double, SUM2 As Double
max = -1E-99 '极值初值
min = 1E+100
For I = 1 To NK
maxi(I) = -1E-99
mini(I) = 1E+100
NI(I) = 0
Next
For I = 1 To N ''基本数据计算
SUM = SUM + X(I)
SUM2 = SUM2 + X(I) * X(I)
'MsgBox "index " & index(I)
SUMI(index(I)) = SUMI(index(I)) + X(I)
SUMi2(index(I)) = SUMi2(index(I)) + X(I) * X(I)
NI(index(I)) = NI(index(I)) + 1
If mini(index(I)) > X(I) Then mini(index(I)) = X(I)
If maxi(index(I)) > X(I) Then maxi(index(I)) = X(I)
If min > X(I) Then min = X(I)
If max > X(I) Then max = X(I)
Next
For I = 1 To NK ''二级数据计算
' MsgBox I & " " & NI(I)
AVEI(I) = SUMI(I) / NI(I)
SEI2(I) = (SUMi2(I) - SUMI(I) * SUMI(I) / NI(I)) / NI(I)
Next
ave = SUM / N
se2 = (SUM2 - SUM * S
多指标单因素方差分析程序 来自淘豆网m.daumloan.com转载请标明出处.