免费预览已结束,剩余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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- MT/T 1253-2025矿用滚筒采煤机再制造技术要求第1部分:整机
- GH/T 1471-2024果品风味品质评价方法
- 病案科的组织和规范化管理
- 土默特左旗鸿达机械厂钢铸件项目环境影响报告表
- 2024届福建省宁德市第一中学高三第一次检测地理答案
- 云南省昆明市黄冈实验校2026届初三下学期第一次质量调查数学试题含解析
- 内蒙古呼和浩特市名校2026届初三第三次教学质量检测试题英语试题含解析
- 江苏省连云港市灌云县重点名校2025-2026学年初三下学期半期联合考试英语试题含解析
- 哈尔滨2026届初三第十三次双周考英语试题试卷含解析
- 新疆兵团八师一四三团一中学2026年初三中考前热身考试卷语文试题含解析
- 变电站运维方案
- GB/T 45554-2025种猪生产性能测定技术规范
- 伐木承揽合同标准文本
- 2025新人教版七年级下册英语 Unit 8知识点梳理及语法讲义(答案版)
- 食品厂复工复产方案
- 2024年数智工程师职业鉴定考试复习题库(含答案)
- 生态修复绿化项目施工技术标书
- 写字楼装修合同协议
- 人教A版2019必修第一册专题3.2函数的基本性质【十大题型】(原卷版+解析)
- 中医培训课件:《放血疗法》
- 人工智能伦理导论- 课件 3-人工智能伦理
评论
0/150
提交评论