Conducting one-way ANOVA

Analysis of variance (ANOVA) investigates the relationship between categorical independent variables and continuous dependent variables. You can use it to test whether the means of several groups are equal. If there is only one categorical variable as an independent variable, you can perform a one-way ANOVA. On the other hand, if there are more than two categorical variables, you should perform a two-way ANOVA. In this recipe, we discuss how to conduct one-way ANOVA with R.

Getting ready

In this recipe, we will use the oneway.test and TukeyHSD functions.

How to do it…

Perform the following steps to perform a one-way ANOVA:

  1. We begin by visualizing data with a boxplot:
    >data_scientist<- c(95694,82465,85001,74721,73923,94552,96723,90795,103834,120751,82634,55362,105086,79361,79679,105383,85728,71689,92719,87916) ...

Get R for Data Science Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.