1.请在下列横线上完成填空。

①单正态总体均值μ的假设检验

检验方法:Z检验;条件:σ²已知

检验方法:t检验;条件:σ²未知

②两正态总体均值μ的假设检验

检验方法:双样本数据t检验

③成对数据均值μ的假设检验

检验方法:成对样本数据t检验

④χ²检验的应用

检验拟合优度

检验列联表独立性

检验方差一致性

2.大题 (1)已知某水样碳酸钙的真值为20.7mg/L, 方差为4.32。现用某种方法重复该水样11次,碳酸钙含量分布为: 20.9, 20.41, 20.10, 20.00, 20.19, 22.60, 20.99, 20.41, 20,23, 22。请问使用该法测定的碳酸钙含量的均值与真值有无显著差异?(显著性水平为0.05)

library(BSDA)
## Warning: 程辑包'BSDA'是用R版本4.1.3 来建造的
## 载入需要的程辑包:lattice
## 
## 载入程辑包:'BSDA'
## The following object is masked from 'package:datasets':
## 
##     Orange
x = c(20.9, 20.41, 20.10, 20.00, 20.19, 22.60, 20.99, 20.41, 20,23, 22)
z.test(x,mu=20.7,sigma.x=2.08,alternative="two.sided")
## 
##  One-sample z-Test
## 
## data:  x
## z = 0.42038, p-value = 0.6742
## alternative hypothesis: true mean is not equal to 20.7
## 95 percent confidence interval:
##  19.73446 22.19282
## sample estimates:
## mean of x 
##  20.96364

Z统计量为0.42038,该水样中碳酸钙含量的均值为20.96364,p值为0.6742,大于显著性水平0.05,接受零假设,拒绝备选假设,认为无显著差异。

2)在针织漂白过程中,要考虑温度对针织品断裂强度的影响,为了比较70℃与80℃的影响有无差别,在这两个温度下,分别重复做了八次实验,数据如下,问在70℃与80℃的平均断裂强度是否存在显著差别?(假设断裂强度服从正态分布;显著性水平为0.05 )

x=c(20.5,18.7,19.8,20.9,21.5,17.5,21.0,21.2)
y=c(17.7,20.3,20.0,18.8,19.0,20.1,20.0,19.1)
t.test(x,y,var.equal = T,
       paired = T,alternative = "two.sided")
## 
##  Paired t-test
## 
## data:  x and y
## t = 1.0666, df = 7, p-value = 0.3215
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -0.9279155  2.4529155
## sample estimates:
## mean of the differences 
##                  0.7625

t统计量为1.0666,自由度为7,95%置信区间为(-0.9279155 2.4529155)。p值为0.3215,大于显著性水平0.05。因此接受零假设,拒绝备选假设,认为无显著差异。

(3)自行设计场景与创建数据,使用正确的检验方法解决问题并进行简单讨论。 假设在一个1000人的样本中,各有男500人和女500人。其中,脱发且是男性的有200人,脱发且是女性的有30人,剩下的都不脱发。请问脱发与否和性别有没有关系?

x=c(300,200,470,30)
dim(x) <- c(2,2);x
##      [,1] [,2]
## [1,]  300  470
## [2,]  200   30
chisq.test(x,correct = F)
## 
##  Pearson's Chi-squared test
## 
## data:  x
## X-squared = 163.18, df = 1, p-value < 2.2e-16

因为p值<2.2e-16,远小于0.05,故拒绝零假设,接受备选假设,即认为脱发与否和性别有关。