免费预览已结束,剩余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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 生物标志物在糖尿病分型中的临床应用
- 生物标志物与药物临床前研究的转化衔接
- 生物制品稳定性试验风险评估策略应用
- 核燃料元件制造工程师培训考核标准
- 电视台节目策划岗位的应聘面试题参考
- 厦门建发信息技术部工程师岗位面试题库含答案
- 求职知识产权管理岗位面试题库
- 汽车制造质量工程师面试题集及答案解析
- 考试题运输调度经理专业能力测试
- 瓣膜介入器械术后康复方案
- 幼儿园小班音乐歌唱《碰一碰》课件
- 中医诊疗技术操作规程
- CJT 340-2016 绿化种植土壤
- 二年级上册口算练习1000道
- 2023年11月浙江省慈溪技师学院(慈溪杭州湾中等职业学校)公开招聘1名派遣制工作人员笔试历年高频考点-难、易错点荟萃附答案带详解
- 农业水价综合改革
- 23秋国家开放大学《液压气动技术》形考任务1-3参考答案
- 广东省通用安装工程综合定额(2018)Excel版
- 21ZJ111 变形缝建筑构造
- 2023-2024学年四川省凉山州小学语文五年级期末高分试卷详细参考答案解析
- GB/T 1443-2016机床和工具柄用自夹圆锥
评论
0/150
提交评论