您好,欢迎来到化拓教育网。
搜索
您的当前位置:首页非参数统计练习三答案

非参数统计练习三答案

来源:化拓教育网
练习三

1

> su<-c(22,9,4,5,1,16,15,26,47,8,31,7)

> binom.test(min(sum(su>10),sum(su<10)),sum(su!=10),0.5)

Exact binomial test

data: min(sum(su > 10), sum(su < 10)) and sum(su != 10) number of successes = 6, number of trials = 12, p-value = 1

alternative hypothesis: true probability of success is not equal to 0.5 95 percent confidence interval: 0.2109446 0.70554 sample estimates:

probability of success

0.5

> wilcox.test(su-10)

Wilcoxon signed rank test with continuity correction

data: su - 10

V = 53, p-value = 0.22

alternative hypothesis: true location is not equal to 0 2

> binom.test(150,350,0.5)

Exact binomial test

data: 150 and 350

number of successes = 150, number of trials = 350, p-value = 0.00872 alternative hypothesis: true probability of success is not equal to 0.5 95 percent confidence interval: 0.3760959 0.4822657 sample estimates:

probability of success 0.4285714

3 > de<-c(17.3,17.9,18.4,18.1,18.3,19.6,18.6,19.2,17.7,20.0,19.0,18.8,19.3,20.2,19.9) > m=(length(de)+1)/2 > y<-NULL

> for(i in 1:(m-1)){y=c(y,(de[i]-de[i+m]))} > y

[1] -0.4 -2.1 -0.6 -0.7 -1.0 -0.6 -1.3

> binom.test(min(sum(y>0),sum(y<0)),sum(y!=0),0.5)

Exact binomial test

data: min(sum(y > 0), sum(y < 0)) and sum(y != 0)

number of successes = 0, number of trials = 7, p-value = 0.01563 alternative hypothesis: true probability of success is not equal to 0.5 95 percent confidence interval: 0.0000000 0.40961 sample estimates:

probability of success 0 3.4

> a<-c(91,46,108,99,110,105,191,57,34,81) > b<-c(81,51,63,51,46,45,66,,90,28) > d<-NULL

> for(i in 1:length(a)){d=c(d,a[i]-b[i])} > d

[1] 10 -5 45 48 60 125 -7 -56 53 > binom.test(min(sum(d>0),sum(d<0)),sum(d!=0),0.5)

Exact binomial test

data: min(sum(d > 0), sum(d < 0)) and sum(d != 0)

number of successes = 3, number of trials = 10, p-value = 0.3438 alternative hypothesis: true probability of success is not equal to 0.5 95 percent confidence interval: 0.06673951 0.65245285 sample estimates:

probability of success

0.3 3.5

>library(tserious) >

a<-c(0,1,0,1,1,1,0,0,1,1,0,0,0,0,rep(1,9),0,1,0,0,1,1,1,0,1,0,1,0,1,rep(0,8),1,0,1,1,0,0,1,1,1,0,1,0,1,0,0,0,1,0,0,1,0,1,0,1,rep(0,8)) > runs.test(factor(a))

Runs Test

data: factor(a)

Standard Normal = -0.3688, p-value = 0.7123

alternative hypothesis: two.sided 3.6

> v<-c(509,505,502,501,493,498,497,502,504,506,505,508,498,495,496,507,506,507,508,505) > y=v-500 > y

[1] 9 5 2 1 -7 -2 -3 2 4 6 5 8 -2 -5 -4 7 6 7 8 5 > x=sign(y)

> runs.test(factor(x))

Runs Test

data: factor(x)

Standard Normal = -2.4326, p-value = 0.01499 alternative hypothesis: two.sided

> z=(sign(y)+1)/2 > runs.test(factor(z))

Runs Test

data: factor(z)

Standard Normal = -2.4326, p-value = 0.01499 alternative hypothesis: two.sided 7

> binom.test(1,6,0.5)

Exact binomial test

data: 1 and 6

number of successes = 1, number of trials = 6, p-value = 0.2188

alternative hypothesis: true probability of success is not equal to 0.5 95 percent confidence interval: 0.004210745 0.1234579 sample estimates:

probability of success 0.1666667 14

> a<-c(1,2,3) > b<-c(2,3,4) > d<-c(a,b) > d

[1] 1 2 3 2 3 4 > rank(d)

[1] 1.0 2.5 4.5 2.5 4.5 6.0 > mean(rank(d)[c(1,3)]) [1] 2.75

> rank(d)[c(1,2,3)] [1] 1.0 2.5 4.5

> mean(rank(d)[c(1,2,3)]) [1] 2.666667

> mean(rank(d)[c(1:3)]) [1] 2.666667

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- huatuo9.cn 版权所有 赣ICP备2023008801号-1

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务