• Home
  • Textbooks
  • Probability, Statistics, and Data: A Fresh Approach Using R
  • Analysis of Variance and Comparison of Multiple Groups

Probability, Statistics, and Data: A Fresh Approach Using R

Darrin Speegle, Bryan Clair

Chapter 12

Analysis of Variance and Comparison of Multiple Groups - all with Video Answers

Educators


Chapter Questions

Problem 1

Exercises 12.1 - 12.3 require material through Section 12.1.
Consider the chimps data set from the fosdata package. This data set contains 169 observations of (among other things) the average grey hair score grey_score_avg of chimps together with a population that the chimps come from. Suppose that the order of the populations is NIRC, NGOGO, TAI. In the notation of Section 12.1, find $n_1, n_2, n_3$ as well as $\bar{x}_i$. for $i=1,2,3$.

Check back soon!
01:21

Problem 2

If you have 30 independent observations of 3 groups, each of which is normal with the same mean and standard deviation, what is the distribution of the one-way ANOVA test statistic F? Include degrees of freedom.

Sheryl Ezze
Sheryl Ezze
Numerade Educator
View

Problem 3

Create a simulation that shows that the one-way ANOVA test statistic follows an $F$ distribution under the null hypothesis. Assume that you have 4 groups, each with 25 subjects, and each with mean 1 and standard deviation 2. Show via simulation that the ANOVA test statistic $F$ is an $F$ random variable with $k-1$ and $N-k$ degrees of freedom.

Victor Salazar
Victor Salazar
Numerade Educator
03:47

Problem 4

Exercises 12.4 - 12.8 require material through Section 12.2 .
Consider the weight_estimate data in the fosdata package. Children and adults were asked to estimate the weight of an object that an actor picks up. Conduct a one-way ANOVA test at the $\alpha=.05$ level to test whether the means of the weight estimates for the 300 g object are the same across the age groups in the study.

Heena Haldankar
Heena Haldankar
Numerade Educator
15:30

Problem 5

Consider the case0502 data from Sleuth3. Dr. Benjamin Spock was tried in Boston for encouraging young men not to register for the draft. It was conjectured that the judge in Spock's trial did not have appropriate representation of women. The jurors were supposed to be selected by taking a random sample of 30 people (called venires), from which the jurors would be chosen. In the data case0502, the percent of women in 7 judges' venires are given.
a. Create a boxplot of the percent women for each of the 7 judges. Comment on whether you believe that Spock's lawyers might have a point.
b. Determine whether there is a significant difference in the percent of women included in the 6 judges' venires who aren't Spock's judge.
c. Determine whether there is a significant difference in the percent of women induced in
Spock's venires versus the percent included in the other judges' venires combined. (Your answer to part (b) should justify doing this.)

Heena Haldankar
Heena Haldankar
Numerade Educator
01:48

Problem 6

Consider the data in ex0524 in Sleuth3. This gives 2584 data points, where each subject's IQ was measured in 1979 and their income was measured in 2005. Create a boxplot of income for each of the IQ quartiles. Is there evidence to suggest that there is a difference in mean income among the 4 groups of IQ? Check the assumptions necessary to do one-way ANOVA. Does this cause you to doubt your result?

Bryan Luo
Bryan Luo
Numerade Educator
03:46

Problem 7

The built-in data set chickwts measures weights of chicks after six weeks eating various types of feed. Test if the mean weight is the same for all feed types. Are the assumptions for one-way ANOVA reasonable?

James Kiss
James Kiss
Numerade Educator

Problem 8

The data set MASS::immer from the MASS package has data on a trial of barley varieties performed by Immer, Hayes, and Powers in the early 1930's. Test if the total yield (sum of 1931 and 1932) depends on the variety of barley. Are the assumptions for ANOVA reasonable?

Check back soon!
01:42

Problem 9

Exercises 12.9 - 12.13 require material through Section 12.3.
The built-in data set InsectSprays records the counts of living insects in agricultural experimental units treated with different insecticides.
a. Plot the data. Three of the sprays seem to be more effective (less insects collected) than the other three sprays. Which three are the more effective sprays?
b. Use one-way ANOVA to test if the three effective sprays have the same mean. What do you conclude?
c. Use one-way ANOVA to test if the three less effective sprays have the same mean. What do you conclude?
d. Would it be appropriate to use one-way ANOVA on the entire data set? Why or why not?
e. Use oneway. test to test the null hypothesis that all of the mean insect counts are the same for the various sprays versus the alternative that they are not, at the $\alpha=.01$ level.

Adriano Chikande
Adriano Chikande
Numerade Educator

Problem 10

The built-in data set morley gives speed of light measurements for five experiments done by Michelson in 1879.
a. Create a boxplot with one box for each of the five experiments.
b. Compute the sample standard deviation and sample size for each of the five experiments.
c. Use ANOVA to test if the five experiments have the same mean, and report your findings. Careful: the Expt variable is coded as an integer.
d. Use oneway. test to test if the five experiments have the same mean, and report your findings.

Check back soon!

Problem 11

The msleep data set in the ggplot2 package has information about 83 species of mammals.
a. How many mammal species are in each vore group?
b. Make a boxplot to show how sleep_total depends on vore.
c. The group variances are apparently unequal, so use oneway.test to test if the mean sleep total depends on vore.
d. Run the ANOVA anyway. What $p$ value does it report?
Notice that the unequal variance combined with unequal group sizes made a huge difference in the $p$-value.

Check back soon!
View

Problem 12

Estimate the effective type I error rate when performing one-way ANOVA on 4 groups at the $\alpha=.05$ level. Assume groups 1-3 are size 20 and group 4 is size 100. Assume all groups have mean 0, groups 1-3 have standard deviation 1, and group 4 has standard deviation 2.

Victor Salazar
Victor Salazar
Numerade Educator
02:10

Problem 13

Repeat Exercise 12.12, but assume all groups have size 20. Is the effective type I error closer to the $\alpha=.05$ level, or further from it?

Maxime Rossetti
Maxime Rossetti
Numerade Educator
12:25

Problem 14

Exercises 12.14 - 12.22 require material through Section 12.4.
Suppose you have 6 groups of 15 observations each. Groups $1-3$ are normal with mean 0 and standard deviation 3, while groups 4-6 are normal with mean 1 and standard deviation 3. Compare via simulation the power of the following tests of $H_0: \mu_1=\cdots=\mu_6$ versus the alternative that at least one pair is different at the $\alpha=.05$ level.
a. One-way ANOVA.
b. pairwise.t.test, where we reject the null hypothesis if any of the paired $p$-values are less than 0.05 .
The next two exercises use the data set flint from the fosdata package. The data set fosdata: :flint contains data on lead levels in water samples taken from Flint, Michigan, during the "Flint water crisis" of 2015. Three lead measurements were taken at each house, $\mathrm{Pb} 1, \mathrm{~Pb} 2$, and Pb 3 , on first draw, after 45 seconds, and after 2 minutes of water running. As observed in 9.16, the lead levels are highly skew.

Amany Waheeb
Amany Waheeb
Numerade Educator

Problem 15

. a. Make a boxplot showing the distribution of the log levels of Pb 1 for each ward. Notice that ward 0 contains only a single sample. In fact, there is no ward 0 in Flint. Remove that data point before continuing.
b. Do the $\log \mathrm{Pb} 1$ levels for each ward appear normally distributed? Are the variances approximately equal across wards?
c. Use ANOVA to determine if there is a difference in $\log \mathrm{Pb} 1$ levels across the wards of Flint. Report a p-value with your answer.

Check back soon!
04:47

Problem 16

a. Make a boxplot showing the distribution of the $\log$ levels of $\mathrm{Pb} 1, \mathrm{~Pb} 2$, and Pb 3 .
b. Do the three log levels appear normally distributed? Are their variances approximately equal?
c. Explain why it is inappropriate to use one-way ANOVA to test for a difference among the means of the three log lead levels.
d. Use a pairwise $t$-test to determine if there is a difference in log lead level between the first draw, 45 second, and 2 minute samples.

Carolyn Behr-Jerome
Carolyn Behr-Jerome
Numerade Educator
01:11

Problem 17

Suppose you have three populations, all of which are normal with standard deviation 1 , and with means $0,0.5$, and 1 . You take samples of size 30 and perform a pairwise $t$-test.
a. Estimate the percentage of times that at least one of the null hypotheses being tested is rejected when using the "bonferroni" $p$-value adjustment.
b. Estimate the percentage of times that at least one of the null hypotheses being tested is rejected when using the "holm" $p$-value adjustment.

Maxime Rossetti
Maxime Rossetti
Numerade Educator

Problem 18

Consider the data set cows_small in the fosdata package. In this data set, cows in Davis, CA were sprayed with water on hot days to try to cool them down. Each cow was measured with no spray (control), nozzle TK-0.75, and nozzle TK-12.
a. Is one-way ANOVA appropriate to use on this data set? If so, do it. If not, explain why not.
b. Perform pairwise $t$-tests on the three groups with holm $p$-value adjustment and explain.

Check back soon!
03:09

Problem 19

Suppose you perform pairwise $t$-tests on 6 iid groups.
a. How many tests are required?
b. At the $\alpha=0.05$ level, what is the probability of type I error for a single one of these tests?
c. Assume the pairwise tests are independent. Compute the exact probability that a type I error occurs on at least one of these tests.
d. Compare your answer from part (c) to results of the simulation in Example 12.5. Are the pairwise tests independent?

Beth Stone
Beth Stone
Numerade Educator
06:40

Problem 20

Consider the weight_estimate data in the fosdata package. Children and adults were asked to estimate the weight of an object that an actor picks up. In Exercise 12.4, you conducted an ANOVA test at the $\alpha=.05$ level to test whether the means of the weight estimates for the 300 g object are the same across the age groups in the study. Use pairwise.t.test to test all pairs of means at the $\alpha=.05$ level.

Maxime Rossetti
Maxime Rossetti
Numerade Educator
03:04

Problem 21

Consider the frogs data set in the fosdata package. This data set contains measurements from 6 species of frogs, including one new species, dakha, that the authors of the paper found. When establishing that a group of animals is a new species, it can be important to find physiological differences between the group of animals and animals that are nearest genetically. Read more about the data set by typing ?fosdata: :frogs.
a. Create a boxplot of the distance from front of eyes to the nostril versus species. Does it appear that the data satisfies the assumptions for one-way ANOVA?
b. Test $H_0$ (all of the mean distances of the species are the same) versus $H_a$ (not all of the mean distances of the species are the same) at the $\alpha=.05$ level.
c. If you reject $H_0$, look up TukeyHSD in base R , and use it to perform a post-hoc analysis to determine which pairs of mean bill depths are the same, and which are different at the $\alpha=.05$ level. The function TukeyHSD requires ANOVA to be done with the following command: mod_aov <- aov(en - species, data = frogs). Write up your result in an organized fashion with explanations.

Nick Johnson
Nick Johnson
Numerade Educator
01:23

Problem 22

Consider the penguins data set in the palmerpenguins package that was discussed in Chapter 11.
a. Create a boxplot of the variable bill_depth_mm by species. Does it appear that the data satisfies the assumptions for one-way ANOVA?
b. Test $H_0$ (all of the mean bill depths of the species are the same) versus $H_a$ (not all of the mean bill depths are the same) at the $\alpha=.01$ level.
c. If you reject $H_0$, perform a post-hoc analysis as in Exercise 12.21 to determine which pairs of mean bill depths are the same, and which are different at the $\alpha=.01$ level.

Sheryl Ezze
Sheryl Ezze
Numerade Educator