*57*

Eta squared is a measure of effect size that is commonly used in ANOVA models.

It measures the proportion of variance associated with each main effect and interaction effect in an ANOVA model and is calculated as follows:

**Eta squared = SS _{effect} / SS_{total}**

where:

**SS**The sum of squares of an effect for one variable._{effect}:**SS**The total sum of squares in the ANOVA model._{total}:

The value for Eta squared ranges from 0 to 1, where values closer to 1 indicate a higher proportion of variance that can be explained by a given variable in the model.

The following rules of thumb are used to interpret values for Eta squared:

**.01:**Small effect size**.06:**Medium effect size**.14 or higher:**Large effect size

This tutorial provides a step-by-step example of how to calculate Eta squared for variables in an ANOVA model in R.

**Step 1: Create the Data**

Suppose we want to determine if exercise intensity and gender impact weight loss.

To test this, we recruit 30 men and 30 women to participate in an experiment in which we randomly assign 10 of each to follow a program of either no exercise, light exercise, or intense exercise for one month.

The following code shows how to create a data frame to hold the data weâ€™re working with:

#make this example reproducible set.seed(10) #create data frame data rep(c("Male", "Female"), each = 30), exercise=rep(c("None", "Light", "Intense"), each = 10, times=2), weight_loss=c(runif(10, -3, 3), runif(10, 0, 5), runif(10, 5, 9), runif(10, -4, 2), runif(10, 0, 3), runif(10, 3, 8))) #view first six rows of data frame head(data) # gender exercise weight_loss #1 Male None 0.04486922 #2 Male None -1.15938896 #3 Male None -0.43855400 #4 Male None 1.15861249 #5 Male None -2.48918419 #6 Male None -1.64738030 #see how many participants are in each group table(data$gender, data$exercise) # Intense Light None # Female 10 10 10 # Male 10 10 10

**Step 2: Fit the ANOVA Model**

The following code shows how to fit a two-way ANOVA using exercise and gender as factors and weight loss as the response variable:

#fit the two-way ANOVA model model #view the model output summary(model) Df Sum Sq Mean Sq F value Pr(>F) gender 1 15.8 15.80 9.916 0.00263 ** exercise 2 505.6 252.78 158.610

**Step 3: Calculate Eta Squared**

We can calculate the effect size Eta squared for each variable in our model by using the etaSquared() function from theÂ **lsr** package:

#load lsr package library(lsr) #calculate Eta Squared etaSquared(model) eta.sq eta.sq.part gender 0.0258824 0.1504401 exercise 0.8279555 0.8499543

The Eta squared for gender and exercise are as follows:

- Eta squared for gender:
**0.0258824** - Eta squared for exercise:
**0.8279555**

We would conclude that the effect size for exercise is very large while the effect size for gender is quite small.

These results match the p-values shown in the output of the ANOVA table. The p-value for exercise ( <.000 is much smaller than the p-value for gender which indicates that exercise more significant at predicting weight loss.>

**Additional Resources**

The following tutorials explain how to fit various ANOVA models in R:

How to Conduct a One-Way ANOVA in R

How to Conduct a Two-Way ANOVA in R

How to Conduct a Repeated Measures ANOVA in R