3 秩检验

您所在的位置:网站首页 秩统计量定义 3 秩检验

3 秩检验

2023-08-16 01:32| 来源: 网络整理| 查看: 265

3.4 习题5 5.2

解:

对称中心检验问题: \[ \theta=320 \qquad v.s. \qquad \theta>320 \]

# 载入数据 x #> Wilcoxon signed rank test with continuity correction #> #> data: x #> V = 158, p-value = 0.006 #> alternative hypothesis: true location is greater than 320

\(p\)值小于0.05,应当拒绝原假设。

5.3

解:

对称中心检验问题: \[ \theta=10 \qquad v.s. \qquad \theta\ne 10 \]

(1)符号检验:

d Exact binomial test #> #> data: S1 and S1 + S2 #> 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.211 0.789 #> sample estimates: #> probability of success #> 0.5

\(p\)值巨大,应当接受原假设。

(2)Wilcoxon符号秩检验:

wilcox.test(d,alternative = "two.sided",mu = x,exact = FALSE) #> #> Wilcoxon signed rank test with continuity correction #> #> data: d #> V = 53, p-value = 0.3 #> alternative hypothesis: true location is not equal to 10

\(p\)值大于0.05也是接受原假设,但\(p\)值相对于符号检验要小很多。

5.4

解:

成对数据的检验,采用Wilcoxon符号秩检验。 \[ E(D)=0\qquad v.s. \qquad E(D)\ne 0 \]

x #> Wilcoxon signed rank test with continuity correction #> #> data: x and y #> V = 31, p-value = 0.08 #> alternative hypothesis: true location shift is not equal to 0

有打结:

t 1] #> 4 #> 3

只有1个结,长度为3.本来写好了一个函数用于修正统计量,但是扒了源代码发现关于打结的修正依旧包含在函数中了,只是当样本数少于50或打结时会出现提醒.可以利用命令查看源代码:

stats:::wilcox.test.default

所以在显著性水平0.05下仍然接受原假设,即认为幼儿园生活对孩子的社会知识没有影响。

5.5

解:

成对数据的检验,采用Wilcoxon符号秩检验。 \[ E(D)=0\qquad v.s. \qquad E(D)\ne 0 \]

x compute exact p-value with ties #> #> Wilcoxon signed rank test with continuity correction #> #> data: x and y #> V = 32, p-value = 0.7 #> alternative hypothesis: true location shift is not equal to 0

在显著性水平0.05下,接受原假设,即认为这段时间的股票指数的波动程度相同。

5.6

解:

位置参数的检验: \[ \delta=0\qquad v.s\qquad \delta\ne 0 \]

采用Wilcoxon秩和检验:

x Wilcoxon rank sum test #> #> data: x and y #> W = 63, p-value = 0.08 #> alternative hypothesis: true location shift is not equal to 0

在显著性水平0.05下应当接受原假设,即认为两种饲料对雌鼠的体重增加的影响不显著。

5.7

解:

位置参数的检验: \[ \delta=0\qquad v.s\qquad \delta\ne 0 \]

采用Wilcoxon秩和检验:

x compute exact p-value with ties #> #> Wilcoxon rank sum test with continuity correction #> #> data: x and y #> W = 72, p-value = 0.004 #> alternative hypothesis: true location shift is not equal to 0

在显著性水平0.05下应当拒绝原假设,即认为这两个厂产品的寿命不同。

5.8

解:

先载入数据:

x compute exact p-value with ties #> #> Wilcoxon signed rank test with continuity correction #> #> data: x and y #> V = 29, p-value = 0.05 #> alternative hypothesis: true location shift is not equal to 0

2.位置参数的检验:

wilcox.test(x,y,mu = 0,alternative = "two.sided",paired = FALSE) #> Warning in wilcox.test.default(x, y, mu = 0, alternative = "two.sided", : cannot #> compute exact p-value with ties #> #> Wilcoxon rank sum test with continuity correction #> #> data: x and y #> W = 72, p-value = 0.03 #> alternative hypothesis: true location shift is not equal to 0

3.尺度参数的检验:

mood.test(x,y,alternative = "two.sided") #> #> Mood two-sample test of scale #> #> data: x and y #> Z = 2, p-value = 0.02 #> alternative hypothesis: two.sided square_rank.test(x,y,alternative = "two.sided") #> #> Square rank test (with ties) #> #> data: x and y #> square rank test statistic = 4, the number of x = 16, the number of y = #> 16, the number of x and y = 32, p-value = 3e-04 #> alternative hypothesis: two.sided

综上,可以看到在显著性水平0.05下,应当认为两个学科的博士论文页数有显著差异,人均页数显著不同,页数离散程度显著不同。

5.9

解:

先载入数据:

x compute exact p-value with ties #> #> Wilcoxon signed rank test with continuity correction #> #> data: x and y #> V = 82, p-value = 0.2 #> alternative hypothesis: true location shift is not equal to 0

2.位置参数的检验:

wilcox.test(x,y,mu = 0,alternative = "two.sided",paired = FALSE) #> Warning in wilcox.test.default(x, y, mu = 0, alternative = "two.sided", : cannot #> compute exact p-value with ties #> #> Wilcoxon rank sum test with continuity correction #> #> data: x and y #> W = 142, p-value = 0.2 #> alternative hypothesis: true location shift is not equal to 0

3.尺度参数的检验:

mood.test(x,y,alternative = "two.sided") #> #> Mood two-sample test of scale #> #> data: x and y #> Z = -3, p-value = 0.007 #> alternative hypothesis: two.sided square_rank.test(x,y,alternative = "two.sided") #> #> Square rank test (with ties) #> #> data: x and y #> square rank test statistic = -3, the number of x = 15, the number of y #> = 15, the number of x and y = 30, p-value = 5e-04 #> alternative hypothesis: two.sided

综上,可以看到在显著性水平0.05下,应当认为两个学校的学生成绩没有显著差异,平均成绩没有显著不同,离散程度有显著不同。

5.10

解:

可以考虑尺度参数的双边检验,方差比较低说明加工精度比较高。

x Mood two-sample test of scale #> #> data: x and y #> Z = 2, p-value = 0.1 #> alternative hypothesis: two.sided

平方秩检验:

square_rank.test(x,y,alternative = "two.sided") #> #> Square rank test (with ties) #> #> data: x and y #> square rank test statistic = 1, the number of x = 10, the number of y = #> 10, the number of x and y = 20, p-value = 0.2 #> alternative hypothesis: two.sided

\(p\)值都大于0.05,应当接受原假设,即认为他们的水平(加工精度)一致。

5.11

解:

尺度参数的双边检验。

x Mood two-sample test of scale #> #> data: x and y #> Z = -0.5, p-value = 0.6 #> alternative hypothesis: two.sided

平方秩检验:

square_rank.test(x,y,alternative = "two.sided") #> #> Square rank test (with ties) #> #> data: x and y #> square rank test statistic = -2, the number of x = 12, the number of y #> = 10, the number of x and y = 22, p-value = 0.03 #> alternative hypothesis: two.sided

在显著性水平0.05下,mood检验表示应当接受原假设,而平方秩检验表示应当拒绝原假设。

但是mood检验需要要求两总体位置参数相等,利用位置参数的检验:

wilcox.test(x,y,alternative = "two.sided",mu = 0,paired = FALSE) #> Warning in wilcox.test.default(x, y, alternative = "two.sided", mu = 0, : cannot #> compute exact p-value with ties #> #> Wilcoxon rank sum test with continuity correction #> #> data: x and y #> W = 0, p-value = 9e-05 #> alternative hypothesis: true location shift is not equal to 0

\(p\)值很小,应当拒绝原假设,即认为两总体的位置参数不等。为了使用mood检验,我们需要估计两总体位置参数,进而平移使他们相等。

# 平移两组样本 x1 Mood two-sample test of scale #> #> data: x1 and y1 #> Z = -2, p-value = 0.04 #> alternative hypothesis: two.sided

\(p\)值小于0.05,应当拒绝原假设。综上,应当认为两组数据的方差存在差异。

5.12

解:

尺度参数的双边检验。

x compute exact p-value with ties #> #> Wilcoxon rank sum test with continuity correction #> #> data: x and y #> W = 92, p-value = 0.03 #> alternative hypothesis: true location shift is not equal to 0

应当拒绝原假设,即认为他们的位置参数不相等。平移数据后再进行mood检验:

# 平移两组样本 x1 Mood two-sample test of scale #> #> data: x1 and y1 #> Z = 3, p-value = 0.004 #> alternative hypothesis: two.sided

平方秩检验:

square_rank.test(x,y,alternative = "two.sided") #> Warning in square_rank.test(x, y, alternative = "two.sided"): The sizes of x and #> y are less than 10. The test may be inaccurate. #> #> Square rank test #> #> data: x and y #> square rank test statistic = 3110, the number of x = 12, the number of #> y = 10, the number of x and y = 22, p-value = 1e-04 #> alternative hypothesis: two.sided

两个检验都表明应当拒绝原假设,即认为他们的尿酸浓度变异不相同。

5.13

解:

关于位置参数的多样本双边检验问题。

A Kruskal-Wallis chi-squared = 8, df = 3, p-value = 0.04

在显著性水平0.05下应当拒绝原假设,即认为这四种药物的治疗效果不同。

5.14

解:

关于位置参数的多样本双边检验问题。

A Kruskal-Wallis chi-squared = 26, df = 3, p-value = 1e-05

\(p\)值很小,应当拒绝原假设,即认为每种培育方法的水稻产量不相同。为了比较任意两种方法的水稻产量之间的差异,需要用的Dunn检验:

DunnTest(x) #> #> Dunn's test of multiple comparisons using rank sums : holm #> #> mean.rank.diff pval #> 2-1 -6.53 0.2438 #> 3-1 7.74 0.2438 #> 4-1 -17.02 0.0021 ** #> 3-2 14.27 0.0141 * #> 4-2 -10.49 0.0778 . #> 4-3 -24.76 8.6e-06 *** #> --- #> Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

在显著性水平0.05下,方法4跟方法1、方法3跟方法2、方法4跟方法3的水稻产量有显著差异。

5.15

关于位置参数的多样本趋势性检验问题。

采用Jonckheere-Terpstra检验:

A JT = 112, p-value = 0.002 #> alternative hypothesis: two.sided

\(p\)值小于显著性水平0.05,应当拒绝原假设,即认为结论可靠。

5.16

解:

关于位置参数的多样本趋势性检验问题。

采用Jonckheere-Terpstra检验:

A JT = 91, p-value = 0.02 #> alternative hypothesis: two.sided

\(p\)值小于显著性水平0.05,应当拒绝原假设,即认为研究者的经验可靠。

5.17

解:

完全区组设计的Friedman检验:

A p-value = 0.05

\(p\) 值略小于显著性水平0.05,应当拒绝原假设,即认为顾客对这三种糕点的爱好并不相同。

5.19

解:

完全区组设计的Page检验,单调上升:

x1 data: t(x) #> L = 685, p-value = 0.2

\(p\)值相差不大。

5.20

解:

平衡的不完全区组设计的Durbin检验:

A #> data: x and y #> S = 90, p-value = 0.01 #> alternative hypothesis: true rho is not equal to 0 #> sample estimates: #> rho #> 0.685 cor.test(x,y,alternative = "two.sided",method = "kendall",exact = F) #> #> Kendall's rank correlation tau #> #> data: x and y #> z = 2, p-value = 0.02 #> alternative hypothesis: true tau is not equal to 0 #> sample estimates: #> tau #> 0.543

Spearman秩相关检验以及Kendall \(\tau\) 检验都表明在显著性水平0.05下应当拒绝原假设,即认为两者具有相关关系。

cor.test(x,y,alternative = "two.sided",method = "pearson") #> #> Pearson's product-moment correlation #> #> data: x and y #> t = 3, df = 10, p-value = 0.02 #> alternative hypothesis: true correlation is not equal to 0 #> 95 percent confidence interval: #> 0.118 0.891 #> sample estimates: #> cor #> 0.648

\(p\)值小于显著性水平0.05,应当拒绝原假设,即应当认为两者具有线性相关关系。

5.22

解:

相关分析:

# 载入数据 x Spearman's rank correlation rho #> #> data: x and y #> S = 26, p-value = 0.002 #> alternative hypothesis: true rho is not equal to 0 #> sample estimates: #> rho #> 0.842 cor.test(x,y,alternative = "two.sided",method = "kendall",exact = F) #> #> Kendall's rank correlation tau #> #> data: x and y #> z = 3, p-value = 0.006 #> alternative hypothesis: true tau is not equal to 0 #> sample estimates: #> tau #> 0.689

Spearman秩相关检验以及Kendall \(\tau\) 检验都表明在显著性水平0.05下应当拒绝原假设,即认为两者具有相关关系。

cor.test(x,y,alternative = "two.sided",method = "pearson") #> #> Pearson's product-moment correlation #> #> data: x and y #> t = 5, df = 8, p-value = 8e-04 #> alternative hypothesis: true correlation is not equal to 0 #> 95 percent confidence interval: #> 0.558 0.971 #> sample estimates: #> cor #> 0.879

\(p\)值小于显著性水平0.05,应当拒绝原假设,即应当认为两者具有线性相关关系。

5.23

解:

Kendall协同系数检验:

A #> data: x and y #> t = -3, df = 10, p-value = 0.03 #> alternative hypothesis: true correlation is not equal to 0 #> 95 percent confidence interval: #> -0.8822 -0.0789 #> sample estimates: #> cor #> -0.625

\(p\)值小于显著性水平0.05,应当拒绝原假设,即认为两者存在线性关系。



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3