streams <- read.table("c:\\temp\\streams.txt",header=T)
attach(streams)
attach(streams)
names(streams)
t.test(down,up)
t.test(down,up,paired=TRUE)
difference <- up - down
t.test(difference)
8.6 The sign test
binom.test(1,9)
sign.test <- function(x, y)
{
if(length(x) != length(y)) stop("The two variables must be the same length")
d <- x - y
binom.test(sum(d > 0), length(d))
}
sign.test(gardenA,gardenB)

本文通过使用R语言进行配对样本t检验,展示了如何读取数据文件、执行统计测试并解释结果。同时介绍了符号检验的应用,并提供了一个自定义函数实现符号检验的过程。

被折叠的 条评论
为什么被折叠?



