统计学(第8版)P163 习题8.4

x <- c(99.3,98.7,100.5,101.2,98.3,99.7,99.5,102.1,100.5)
t.test(x, mu = 100)

    One Sample t-test

data:  x
t = -0.054996, df = 8, p-value = 0.9575
alternative hypothesis: true mean is not equal to 100
95 percent confidence interval:
  99.04599 100.90956
sample estimates:
mean of x 
 99.97778 

统计学(第8版)P163 习题8.7

x <- c(159, 280, 101, 212, 224, 379, 179, 264,
       222, 362, 168, 250, 149, 260, 485, 170)
t.test(x, mu = 225, alternative = "greater")

    One Sample t-test

data:  x
t = 0.66852, df = 15, p-value = 0.257
alternative hypothesis: true mean is greater than 225
95 percent confidence interval:
 198.2321      Inf
sample estimates:
mean of x 
    241.5 

统计学(第8版)P163 习题8.8

library(EnvStats)
x <- c(85, 59, 66, 81, 35, 57, 55, 63, 66)
varTest(x, alternative = "greater", 
        sigma.squared = 100)

Results of Hypothesis Test
--------------------------

Null Hypothesis:                 variance = 100

Alternative Hypothesis:          True variance is greater than 100

Test Name:                       Chi-Squared Test on Variance

Estimated Parameter(s):          variance = 215.75

Data:                            x

Test Statistic:                  Chi-Squared = 17.26

Test Statistic Parameter:        df = 8

P-value:                         0.02751276

95% Confidence Interval:         LCL = 111.3023
                                 UCL =      Inf

统计学(第8版)P157 例题8.15

before <- c(94.5, 101, 110, 103.5, 97, 
            88.5, 96.5, 101, 104, 116.5)
after <- c(85, 89.5, 101.5, 96, 86, 
           80.5, 87, 93.5, 93, 102)

t.test(before, after, alternative = "greater", 
       mu = 8.5, paired = TRUE)

    Paired t-test

data:  before and after
t = 1.9413, df = 9, p-value = 0.04207
alternative hypothesis: true mean difference is greater than 8.5
95 percent confidence interval:
 8.575214      Inf
sample estimates:
mean difference 
           9.85 

统计学(第8版)P164 习题8.10

  1. 两种方法的装配时长的方差是否相等?显著性水平为0.05.
<- c(31, 34, 29, 32, 35, 38, 
       34, 30, 29, 32, 31, 26)
<- c(26, 24, 28, 29, 30, 29, 
       32, 26, 31, 29, 32, 28)

var.test(甲,乙)

    F test to compare two variances

data:  甲 and 乙
F = 1.6837, num df = 11, denom df = 11, p-value = 0.4009
alternative hypothesis: true ratio of variances is not equal to 1
95 percent confidence interval:
 0.4847138 5.8488408
sample estimates:
ratio of variances 
           1.68375 

P值等于0.4,在0.05的显著性水平下,不拒绝“方差相等的原假设”

  1. 能否认为甲方法装配时长的均值显著高于乙方法装配时长的均值?显著性水平为0.05.

方差相等的t检验

t.test(甲,乙, alternative = "greater",
       var.equal = TRUE)

    Two Sample t-test

data:  甲 and 乙
t = 2.6484, df = 22, p-value = 0.007339
alternative hypothesis: true difference in means is greater than 0
95 percent confidence interval:
 1.084184      Inf
sample estimates:
mean of x mean of y 
 31.75000  28.66667 

P值等于0.007,在0.05的显著性水平下,拒绝“miu_甲<=miu_乙”的原假设。

认为甲方法装配时长的均值显著高于乙方法装配时长的均值