已阅读5页,还剩1页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
Dim nindex As LongDim indexNAME(20) As StringDim indexMAX(20) As LongDim indexORDER(20, 20) As StringDim nsample As LongDim indextable(20, 500) As IntegerDim currentROW As Long 迭代的最大次数Const EULER = 0.5772156649Const FPMIN = 1E-30 为防止除0使用的常数以下2012.06.08 加 分析基本统计参数,不能应用复杂统计程序求解,以减少计算时间及程序复杂性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 * SUM / N) / NEnd Sub以上2012.06.08 加Sub 多指标方差分析及多重比较() 测试用20110307晚 Dim I As Integer, J As Integer, N As Integer Dim NK As Integer, nxy As Integer: Dim tool As New stat_tool_OK_20120414 Dim anova As New ssanddf_A_R_ok NK = 8 nxy = 4 N = 244 ReDim a(N, 3) As String, X(N, 11) As Double, indexa(N, N) As Integer, indexSTR(58, N) As String, xname(nxy) As String For I = 1 To N: For J = 1 To nxy a(I, 1) = Cells(I + 1, 2) 可以更改列数 X(I, J) = Cells(I + 1, J + 2) Next: Next tool.索引化 a, N, 2, indexa, indexSTR For I = 1 To N Cells(I + 1, 8) = indexa(I, 1) Next MsgBox ReDim xX(N) As Double ReDim index(N) As Integer Dim ff As Double, p As Double For I = 1 To N: index(I) = indexa(I, 1): Next ReDim SEI2(NK) As Double, NI(NK) As Integer, AVEI(NK) As Double, maxi(NK) As Double, mini(NK) As Double ReDim nam(NK) As String, newname(NK) As String, LABLE(NK) As String Dim se2 As Double, ave As Double, max As Double, min As Double For I = 1 To NK nam(I) = indexSTR(1, I) Next Dim SORTKEY(20) As Double, NEWSORTKEY(20) As Double, NEWNI(20) As Integer, newSE(20) As Double, f As Integer Dim SE(20) As Double For J = 1 To nxy 外循环,变量 For I = 1 To N: xX(I) = X(I, J): Next Call basestat(index, xX, N, NK, AVEI, NI, SEI2, mini, maxi, ave, se2, min, max) For I = 1 To NK SORTKEY(I) = AVEI(I) Next anova.SSanddf_A_R index, xX, N ff = anova.MSa / anova.MSe p = tool.vbaFDIST(ff, anova.dfa, anova.dfe) tool.BlockSort_multSE SORTKEY, nam, NI, SEI2, NEWSORTKEY, newname, NEWNI, newSE, NK Cells(N + 5 + (NK + 5) * (J - 1) - 1, 1) = Cells(1, J + 2) & F Cells(N + 5 + (NK + 5) * (J - 1) - 1, 2) = 因素均方 Cells(N + 5 + (NK + 5) * (J - 1) - 1, 3) = 误差均方 Cells(N + 5 + (NK + 5) * (J - 1) - 1, 4) = 因素自由度 Cells(N + 5 + (NK + 5) * (J - 1) - 1, 5) = 误差自由度 Cells(N + 5 + (NK + 5) * (J - 1) - 1, 6) = 无差别概率 Cells(N + 5 + (NK + 5) * (J - 1), 1) = ff Cells(N + 5 + (NK + 5) * (J - 1), 2) = anova.MSa Cells(N + 5 + (NK + 5) * (J - 1), 3) = anova.MSe Cells(N + 5 + (NK + 5) * (J - 1), 4) = anova.dfa Cells(N + 5 + (NK + 5) * (J - 1), 5) = anova.dfe Cells(N + 5 + (NK + 5) * (J - 1), 6) = p For I = 1 To NK Cells(N + 6 + (NK + 5) * (J - 1), 1) = 水平名称 Cells(N + 6 + (NK + 5) * (J - 1), 2) = 均值 Cells(N + 6 + (NK + 5) * (J - 1), 3) = 方差 Cells(N + 6 + (NK + 5) * (J - 1), 4) = 频次 Cells(N + 6 + (NK + 5) * (J - 1), 5) = 0.05水平 Cells(N + 6 + (NK + 5) * (J - 1), 6) = 0.01水平 Cells(N + 6 + (NK + 5) * (J - 1) + I, 1) = newname(I) Cells(N + 6 + (NK + 5) * (J - 1) + I, 2) = NEWSORTKEY(I) Cells(N + 6 + (NK + 5) * (J - 1) + I, 3) = newSE(I) Cells(N + 6 + (NK + 5) * (J - 1) + I, 4) = NEWNI(I) Next tool.multicompT_multSE newname, NEWNI, NEWSORTKEY, LABLE, f, newSE, 0.05, NK 改用两两比较更适合 For I = 1 To NK Cells(N + 6 + (NK + 5) * (J - 1) + I, 5) = LABLE(I) Next tool.multicompT_multSE newname, NEWNI, NEWSORTKEY, LABLE, f, newSE, 0.01, NK 改用两两比较更适合 For I = 1 To NK Cells(N + 6 + (NK + 5) * (J - 1) + I, 6) = LABLE(I) Next Next End SubSub test分类() 测试用20110307晚 Dim aname As Range Dim I As Integer, J As Integer, N As Integer, nxy As Integer Dim tool As New stat_tool_OK_20120414 Dim anova As New ssanddf_A_R_ok N = 11 ReDim a(N, 58) As String, X(N) As Double, indexa(N, 58) As Integer, index(N) As Integer, indexSTR(N, 58) As String For I = 1 To N X(I) = Cells(I + 1, 13) Next For I = 1 To N: For J = 1 To N - 2 a(I, J) = Cells(I + 1, J + 1) Next: Next tool.索引化 a, N, N - 2, indexa, indexSTR For J = 1 To N - 2 For I = 1 To N index(I) = indexa(I, J) Next anova.SSanddf_A_R index, X, N Dim ff As Double, p As Double ff = anova.MSa / anova.MSe p = tool.vbaFDIST(ff, anova.dfa, anova.dfe) Cells(22, 1 + J) = p Cells(23, 1 + J) = ff Cells(24, 1 + J) = anova.SSa Cells(25, 1 + J) = anova.dfa Cells(26, 1 + J) = anova.SSe Cells(27, 1 + J) = anova.dfe Next a.multiComp aNAME, SSR, 15, 6.73, 0.05 a.multiComp aNAME, SSR, 15, 6.73, 0
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 公墓安葬协议书
- 白蚁防治协议书
- 份额预留协议书
- 租赁协议书解除协议书
- 2025冷冻车租赁合同
- 安防监控协议书
- 游泳班招生协议书
- 车位准让协议书
- 2025网络安全转让合同范本
- 2025年辽宁公安考试真题及答案
- 毕业设计(论文)-快递送货无人车结构及控制系统设计
- 2024年湖北省建始县安监局公开招聘试题含答案分析
- CJ/T 328-2010球墨铸铁复合树脂水箅
- T/CECS 10013-2019双冷源新风机组
- 电表更名协议书
- 入团团员考试试题及答案
- 2024年佛山市顺德区公办中小学招聘教师真题
- 老年综合评估技术应用中国专家共识解读
- 营口职业技术学院2025年单独招生考试教育类题库(中职生适用)
- 【中国人寿财险湖南省分公司全面预算管理问题原因分析案例9800字】
- 2025年四川省绵阳市涪城区八年级中考一模生物试题(原卷版+解析版)
评论
0/150
提交评论