a <- c(86, 82, 74, 85, 76, 79, 82, 83, 83, 79, 82)
b <- c(81, 77, 63, 75, 69, 86, 81, 60)
shapiro.test(a)
##
## Shapiro-Wilk normality test
##
## data: a
## W = 0.93295, p-value = 0.4414
shapiro.test(b)
##
## Shapiro-Wilk normality test
##
## data: b
## W = 0.94077, p-value = 0.6187
var.test(a,b)
##
## F test to compare two variances
##
## data: a and b
## F = 0.15791, num df = 10, denom df = 7, p-value = 0.009825
## alternative hypothesis: true ratio of variances is not equal to 1
## 95 percent confidence interval:
## 0.03316711 0.62372643
## sample estimates:
## ratio of variances
## 0.1579125
t.test(a,b, paired = FALSE, var.equal = FALSE, alternative = "two.sided")
##
## Welch Two Sample t-test
##
## data: a and b
## t = 2.0356, df = 8.6206, p-value = 0.07366
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -0.831606 14.831606
## sample estimates:
## mean of x mean of y
## 81 74
#H0<= 0.11 Ha: > 0.11
binom.test(18, 120, p = 0.11, alternative = "greater" )
##
## Exact binomial test
##
## data: 18 and 120
## number of successes = 18, number of trials = 120, p-value = 0.1079
## alternative hypothesis: true probability of success is greater than 0.11
## 95 percent confidence interval:
## 0.09924886 1.00000000
## sample estimates:
## probability of success
## 0.15
#因為p = 0.1079 >0.05, 所以沒有推翻虛無假說,所以失業率沒有高於11%)