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的更多相关文章

  1. Applied Nonparametric Statistics-lec10

    Ref:https://onlinecourses.science.psu.edu/stat464/print/book/export/html/14 估计CDF The Empirical CDF ...

  2. Applied Nonparametric Statistics-lec9

    Ref:https://onlinecourses.science.psu.edu/stat464/print/book/export/html/12 前面我们考虑的情况是:response是连续的, ...

  3. Applied Nonparametric Statistics-lec7

    Ref: https://onlinecourses.science.psu.edu/stat464/print/book/export/html/9 经过前面的步骤,我们已经可以判断几个样本之间是否 ...

  4. Applied Nonparametric Statistics-lec6

    Ref: https://onlinecourses.science.psu.edu/stat464/print/book/export/html/8 前面都是对一两个样本的检查,现在考虑k个样本的情 ...

  5. Applied Nonparametric Statistics-lec5

    今天继续two-sample test Ref: https://onlinecourses.science.psu.edu/stat464/print/book/export/html/6 Mann ...

  6. Applied Nonparametric Statistics-lec4

    Ref: https://onlinecourses.science.psu.edu/stat464/print/book/export/html/5 Two sample test 直接使用R的t- ...

  7. Applied Nonparametric Statistics-lec3

    Ref: https://onlinecourses.science.psu.edu/stat464/print/book/export/html/4 使用非参数方法的优势: 1. 对总体分布做的假设 ...

  8. Applied Nonparametric Statistics-lec2

    Ref: https://onlinecourses.science.psu.edu/stat464/print/book/export/html/3 The Binomial Distributio ...

  9. Applied Nonparametric Statistics-lec1

    参考网址: https://onlinecourses.science.psu.edu/stat464/node/2 Binomial Distribution Normal Distribution ...

随机推荐

  1. 使用Zeppelin时出现sh interpreter not found错误的解决办法(图文详解)

    不多说,直接上干货! 问题详解 http://192.168.80.145:8099/#/notebook/2CSV2VT5S 相关博客是 Zeppelin的入门使用系列之使用Zeppelin运行sh ...

  2. Ubuntu下安装nginx及使用

    首先介绍以下nginx.下图来自百科介绍:详细介绍地址:https://baike.baidu.com/item/nginx/3817705?fr=aladdin 在我们平时的开发娱乐中,也许并不会涉 ...

  3. PHP正则表达式 - 附录(常用正则表达式)

    常用正则表达式附录I 平时做网站经常要用正则表达式,下面是一些讲解和例子,仅供大家参考和修改使用: "^\d+$" //非负整数(正整数 + 0) "^[0-9]*[1- ...

  4. Mybatis find_in_set 子查询,替代 in

    1. Mapper文件 2.dao层 3.生成Sql

  5. AJPFX深入理解之abstract class和interface的区别

    含有abstract修饰符的class即为抽象类,abstract 类不能创建的实例对象.含有abstract方法的类必须定义为abstract class,abstract class类中的方法不必 ...

  6. 客户端rsyslog配置文件详解

    客户端rsyslog配置文件详解 最近再开发一个rsyslog的接收服务端,支持udp,tcp和tls三种协议.所以去仔细研究了一下rsyslog.conf的配置文件,下面来详细说一下. 因为我这儿重 ...

  7. 2、HTTP状态码

    HTTP状态码 当浏览者访问一个网页时,浏览者的浏览器会向网页所在服务器发出请求.当浏览器接收并显示网页前,此网页所在的服务器会返回一个包含HTTP状态码的信息头(server header)用以响应 ...

  8. UNITY_MATRIX_MVP和UnityObjectToClipPos

    在unity5.6以上版本中,shader中的UNITY_MATRIX_MVP将会被UnityObjectToClipPos替代,以后我们在写顶点函数时就是这样的 v2f vert(appdata v ...

  9. 程序员的智囊库系列之3--分布式文件系统(Distributed file systems)

    程序员的智囊库系列之3--分布式文件系统(Distributed file systems) 这是程序员的智囊库系列的第三篇文章.上一篇文章本来打算介绍几个搭建网站的框架,但由于这部分的内容较多,还需 ...

  10. 解决nginx bind() to 0.0.0.0:80 failed 问题

    nginx的配置文件一开始默认是80端口,出现这个错误多半是80端口已经被占用.这时候只需要把 server { listen 8088; server_name localhost lcsf.com ...