# Ch. 8 Tests of Hypotheses Based on a Single Sample

Sections covered: 8.1, 8.2, 8.3, 8.4, 8.5

## 8.1 Hypotheses and Test Procedures

Note: We will cover the beginning of the section and then return to errors in hypothesis testing (beginning on page 317) after Section 8.2.

Skip: Examples 8.1 and 8.4 (hypothesis testing and type II error calculation for small sample proportions)

xkcd cartoon: “Significant” (Jelly Beans Cause Acne!)

## 8.2 *z* Tests for Hypotheses about a Population Mean

Skip: calculating Type II error and sample size needed for two sided tests (3rd and 5th formulas in the blue box on p. 331)

## 8.4 Tests Concerning a Population Proportion

Skip: \(\beta\) and Sample Size Determination (pp. 348-349)

## Practice Exercises

**\(1.\) (One sample test, Values given)** We wish to test whether a scale needs to be recalibrated. If it’s working, a 10 pound weight should weigh 10 pounds. We decide to test it by weighing the same weight, which we know to be precisely 10 pounds, 25 times. We know the weights from this scale are normally distributed and independent, with a true standard deviation of \(\sigma\) = 1. Our sample mean (x) is 9.85. Should we conclude that recalibration is necessary x (that is, the scale is off) or not necessary (the scale isn’t conclusively off)?

\(α = .01\)

\(H_0: \mu = 10\)

\(H_A: \mu \neq 10\)

Test statistic: \(z=\frac{\bar{X} - \mu_0}{\sigma/\sqrt{n}}\)

```
z <- (9.85-10)/(1/sqrt(25))
z
```

`## [1] -0.75`

Determine the p-value:

```
pval <- pnorm(z)*2
pval
```

`## [1] 0.4532547`

Since 0.453 > .05, we do not reject the null hypothesis. In other words, even if the scale were perfectly calibrated (\(\mu = 10\)) there is over a 45% probability that we would get a sample mean less than or equal to 9.85 (or equal to or greater than 10.15), that is, the same or further from the true mean than we found. Therefore, on the basis on these results, recaliberation is not necessary.

**\(2.\) (One sample test, Raw values)** We know that the mean sepal length of setosas (a species of irises) is 4.8 cm. A new study examines a sample of 50 flowers and shows that the sample mean is 5.006 cm. Conduct a one-tailed hypothesis test at \(.05\) significance level to show if there is sufficient evidence to reject the hypothesis that the mean of the new sample is equal to 4.8 cm.

\(α = .05\)

\(H_0: \mu = 4.8\)

\(H_A: \mu > 4.8\)

Use the following code to store the 50 values in the sample in a variable called `setosa`

. (This works because `iris`

is a built-in dataset in R.)

`setosa <- iris[iris$Species == "setosa",]`

[Ans]

Test statistic: \(z=\frac{\bar{X} - \mu_0}{s/\sqrt{n}}\)

`## [1] 4.132433`

```
pval <- 1- pnorm(z)
pval
```

`## [1] 1.794718e-05`

```
# simpler approach
# p-values might be a bit different due to approximation of t
t.test(setosa$Sepal.Length, alternative = "greater", mu = 4.8)
```

```
##
## One Sample t-test
##
## data: setosa$Sepal.Length
## t = 4.1324, df = 49, p-value = 6.986e-05
## alternative hypothesis: true mean is greater than 4.8
## 95 percent confidence interval:
## 4.922425 Inf
## sample estimates:
## mean of x
## 5.006
```

Since 6.986e-05 < 0.05 , we reject the null hypothesis. There is sufficient evidence that the true mean of setosa sepal length is greater than 4.8 cm.