We can formulate ANOVA as [[base/R/linear regression]] in [[R]] to simplify interpretation, use statistical inference to test hypotheses. A low [[p-value]] for the[[ F-statistic ]]indicates evidence of differences between groups.
R will drop one factor level, selecting the first alphanumerically to drop. The dropped level is referred to as the baseline group. To relevel, use `relevel`.
The intercept is the expected response in the baseline group.
$\hat \mu_1 = \hat \beta_0$
The slope of each parameter is the expected change in the mean of the response between the baseline group to the $j^{th}$ group (for $j = 2, \dots, J$).
$\hat \mu_{j} = \hat \beta_0 + \hat \beta_j$
Mutate the dataset to create factors from categorical variables if needed and label them for ease of use.
```R
df <- read.csv("path/to/data")
df <- df %>%
mutate(factor_col = as.factor(factor_col))
levels(df$factor_col) <- c("A", "B"))
```