




已阅读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乐山市秋招笔试EPI能力测试题专练及答案
- 农业银行2025潮州市结构化面试15问及话术
- 工商银行2025秋招半结构化面试题库及参考答案陕西地区
- 交通银行2025秋招无领导模拟题角色攻略海南地区
- 邮储银行2025防城港市数据分析师笔试题及答案
- 交通银行2025威海市半结构化面试15问及话术
- 中国银行2025秋招半结构化面试题库及参考答案宁夏地区
- 邮储银行2025济源市秋招笔试EPI能力测试题专练及答案
- 农业银行2025忻州市金融科技岗笔试题及答案
- 邮储银行2025数据分析师笔试题及答案甘肃地区
- 污水排污协议书
- 饲料采购工作总结
- 新课标解读丨《义务教育道德与法治课程标准(2022年版)》解读课件
- 能源管理培训课件
- 江苏省苏州市2024-2025学年高一上学期期末调研英语试题(解析版)
- 体育赛事直播技术服务合同
- 护理礼仪(第3版) 课件 第四章 护士仪态礼仪
- 认识中国特色社会主义文化
- 森林防火林区道路建设基本要求
- 《钢铁行业智能制造标准体系建设指南(2023版)》
- 设计材料与工艺课程 课件 第1章 产品设计材料与工艺概述
评论
0/150
提交评论