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 ...
随机推荐
- Windows和Ubuntu使用网线直连搭建局域网
1.Windows下的配置:右键右下角的网络图标(或者右键网络→属性)→更改适配器设置→以太网→右键属性→TCP/IPv4→IP地址(192.168.1.3)→子网掩码(255.255.255.0)→ ...
- C# 指定WebBrowser 的 User Agent 版本
今天用WebBrowser 打开网页,本机ie是ie9 可是WebBrowser 显示的效果明显不是ie9 ,百度查资料才知道,其实是因为直接用IE跟使用WebBrowser 运行的是不同的User ...
- cloud turbine
turbine是聚合服务器发送事件流数据的一个工具,hystrix的监控中,只能监控单个节点,实际生产中都为集群,因此可以通过 turbine来监控集群下hystrix的metrics情况,通过eur ...
- javascript中两种基本常用排序算法分析
备注:内容大部分从网上复制,代码为自己手写.仅做知识的温故知新,并非原创. 1.冒泡排序(Bubble Sort) (1)算法描述 冒泡排序是一种简单的排序算法.它重复地走访过要排序的数列,一次比较两 ...
- 【Unity3D】射箭打靶游戏(简单工厂+物理引擎编程)
打靶游戏: 1.靶对象为 5 环,按环计分: 2.箭对象,射中后要插在靶上: 3.游戏仅一轮,无限 trials: 增强要求: 添加一个风向和强度标志,提高难度 游戏成品图: U ...
- Vmware 虚拟硬盘 合并多个分割文件
有时,当我们创建虚拟机vmware里面的应用程序,我们可能会选择创建分割的虚拟磁盘中的多个文件2 GB的文件,这是为了提高复制过程,主要用于存储虚拟机文件系统不支持创建更大的文件. 如果我们需要将它转 ...
- 变更gcc版本
当前的GCC版本为GCC-4.2,需要切换到GCC-3.4.首先,你需要去你的usr/bin/下去看看有没有gcc-3.4这样文件,如果没有的话,就安装一下吧: apt-get install gcc ...
- Python3+Selenium3+webdriver学习笔记10(元素属性、页面源码)
#!/usr/bin/env python# -*- coding:utf-8 -*-'''Selenium3+webdriver学习笔记10(元素属性.页面源码)'''from selenium i ...
- jQuery UI -- Repeater & 手风琴(Accordion)效果
jQuery UI -- Repeater & 手风琴(Accordion)效果 很简单的范例,完全不用写程序 直接套用就能做! 但是,基础不稳的人,连「复制贴上」直接套用, 对您而言,都困难 ...
- SAP标准培训课程C4C10学习笔记(一)第一单元
C4C10:SAP Hybris Cloud for Customer Administration 课程目录: 第一单元是C4C的简介. 作为SAP推出的一个SaaS(Software as a s ...