Applied Nonparametric Statistics-lec8
Ref:https://onlinecourses.science.psu.edu/stat464/print/book/export/html/11
additive model
value = typical value + row effect + column effect + residual
predicate value = typical value + row effect + column effect
其中value是我们关注的值,typical value是overall median,row effect是block effect,column effect是treatment effect
下面用例题来展示:
问题:对于面包中烟酸(维生素B3)的含量,三个实验室(abc)的测量方法可能不同。烟酸的含量分为三档:
no niacin、2mg/100gm、4mg/100gm。我们把一些样本送到三个实验室做检测,希望知道:划分档次时,是否
基于烟酸的实际含量。
输入:niacin_r.txt(参见网页)
步骤一:
Plots the mean (or other summary) of the response for two-way combinations of factors, thereby illustrating possible interactions.
data = read.table("niacin_r.txt", header=F, sep=",")
data = as.data.frame(data)
names(data)=c("niacin", "lab", "level")
attach(data)
interaction.plot(lab, level, niacin, fun=median)
detach(data)
结果如图

因为三条线基本是平行的(没有明显的交叉),所以我们可以继续做。(additive model没有考虑interaction的情况)
现在需要整理一下数据:首先将数据按照lab和level聚集一下
a=aggregate(niacin~lab+level, data=data, median)
结果是这样的:
> a
lab level niacin
1 a 0 36
2 b 0 38
3 c 0 39
4 a 2 53
5 b 2 56
6 c 2 55
7 a 4 68
8 b 4 76
9 c 4 73
然后将它变成矩阵,每一行表示block(这里是level水平,0,2,4),每一列表示treat(这里是lab,abc)
> m=matrix(a[,3], nrow=3, ncol=3, byrow=T)
> m
[,1] [,2] [,3]
[1,] 36 38 39
[2,] 53 56 55
[3,] 68 76 73
步骤二:median polish
> medpolish(m)
1: 7
Final: 7 Median Polish Results (Dataset: "m") Overall: 55 Row Effects:
[1] -17 0 18 Column Effects:
[1] -2 1 0 Residuals:
[,1] [,2] [,3]
[1,] 0 -1 1
[2,] 0 0 0
[3,] -3 2 0
这样我们已经得到了完整的additive model,其中typical value即overall,也就是55。
注意:medpolish实际是将前面的结果做了一个拆分,比如
m[1,1] = 36 = overall + column_effect[1] + row_effect[1] + residuals[1, 1] = 55 + (-17) + (-2) + 0
为了确定模型的好坏,我们计算统计量R*。如上例,TV是55,计算出R*约为0.9346,也就是说,考虑了lab和level的这种
additive model,可以解释93%的烟酸水平评定结果。
(the additive model of the labs and levels of niacin explain about 93% of the variation in the measured niacin levels.)

如果三条线有交叉,就要对每个block(每行)分别进行考虑,使用kruskal test。如果overall error rate是0.09,3个block的话,
那么每个的α值就是0.03(p值小于它就拒绝原假设)。
判断interaction的统计量可以用上面得到的Residuals矩阵,使用Q这个统计量,使用自由度为(b-1)×(k-1)的卡方分布决定p值

Dichotomous Data (Cochran's Tests)
b个block,k个treatment,实际数值只有两种,即0和1

前提:blocks是随机选择的;结果变量是二值化的。
假设:
H0:treatments are equally effective
H1:difference in effectiveness among treatments.
Applied Nonparametric Statistics-lec8的更多相关文章
- Applied Nonparametric Statistics-lec10
Ref:https://onlinecourses.science.psu.edu/stat464/print/book/export/html/14 估计CDF The Empirical CDF ...
- Applied Nonparametric Statistics-lec9
Ref:https://onlinecourses.science.psu.edu/stat464/print/book/export/html/12 前面我们考虑的情况是:response是连续的, ...
- Applied Nonparametric Statistics-lec7
Ref: https://onlinecourses.science.psu.edu/stat464/print/book/export/html/9 经过前面的步骤,我们已经可以判断几个样本之间是否 ...
- Applied Nonparametric Statistics-lec6
Ref: https://onlinecourses.science.psu.edu/stat464/print/book/export/html/8 前面都是对一两个样本的检查,现在考虑k个样本的情 ...
- Applied Nonparametric Statistics-lec5
今天继续two-sample test Ref: https://onlinecourses.science.psu.edu/stat464/print/book/export/html/6 Mann ...
- Applied Nonparametric Statistics-lec4
Ref: https://onlinecourses.science.psu.edu/stat464/print/book/export/html/5 Two sample test 直接使用R的t- ...
- Applied Nonparametric Statistics-lec3
Ref: https://onlinecourses.science.psu.edu/stat464/print/book/export/html/4 使用非参数方法的优势: 1. 对总体分布做的假设 ...
- Applied Nonparametric Statistics-lec2
Ref: https://onlinecourses.science.psu.edu/stat464/print/book/export/html/3 The Binomial Distributio ...
- Applied Nonparametric Statistics-lec1
参考网址: https://onlinecourses.science.psu.edu/stat464/node/2 Binomial Distribution Normal Distribution ...
随机推荐
- NPOI导出EXCEL后公式无结果,公式重新计算开关
但其实这个选项是可以控制的.在NPOI中,这个属性叫做XSSFSheet.ForceFormulaRecalculation. 打开该选项的话,代码为 sheet1.ForceFormulaRecal ...
- SpringMVC简介01
SpringMVC也叫Spring Web mvc,属于表现层的框架.SpringMVC是Spring框架的一部分,是在Spring3.0后发布的. Spring结构图: SpringMVC架构: S ...
- Tomcat 下载及配置
1.下载 下载地址:http://tomcat.apache.org/ 进去后下拉到底部 2.解压 Tomcat不需要安装,直接解压即可.解压后会得到这么一个文件夹 3.在MyEclipse中配置To ...
- 超文本传输协议(HTTP)
超文本传输协议(HyperText Transfer Protocol,Http)是从服务器传输数据到客户端的传输协议. HTTP协议的主要特点可概括如下: 1.支持客户/服务器模式. 2.简单快速: ...
- I/O操做总结(二)
文件的操作 这一节我们来讨论关于文件自身的操作 不浪费唾沫了,用代码说话…… 实例1:创建文件对象 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ...
- 《移动Web前端高效开发实战》笔记4--打造单页应用SPA
路由是一个单页应用的核心,大部分前端框架都实现了一个复杂的路由库,包括动态路由,路由钩子,组件生命周期甚至服务器端渲染等复杂的功能.但是对于前端开发者而言,路由组件的核心是URL路径到函数的映射,了解 ...
- hive中select中DISTINCT的技巧和使用
hive中select中DISTINCT的技巧和使用 单表的唯一查询用:distinct 多表的唯一查询用:group by 在使用MySQL时,有时需要查询出某个字段不重复的记录,虽然mysql提供 ...
- 在Windows Server 2012中搭建SQL Server 2012故障转移集群
OK~ WSFC 2012 R2 年度盛宴开始~ 在本文中,老王将用一系列的场景,把动态仲裁,动态见证,票数调整,LowerQuorumPriorityNodeID,阻止仲裁等群集仲裁技术串起来,完成 ...
- 【LeetCode】4.Median of Two Sorted Arrays 两个有序数组中位数
题目: There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the ...
- 有一个无效 SelectedValue,因为它不在项目列表中
“Drp_XX”有一个无效 SelectedValue,因为它不在项目列表中 出现以上异常的原因肯定是将DrowDownList控件的SelectedValue属性赋值为一个列表中不存在的值.那么我们 ...