“R”-ent you glad I ran an ANOVA?

Howdy!

I recently wrote a blog post exploring multiple regression in R — — and more specifically, with my masters thesis data! It was really quick and only scratched the surface, but it was a great experience and I thought it was a cool way to explore not only my data further, but get into multiple regression in practice and learn more R!

This week I’d like to do something very similar: run ANOVAs! On my thesis data! In R!

A huge perk of this post is that I’ve already run these analyses in SPSS and I already have the correct data to check against. Last week, I ran a regression and had no way of checking my work really.

For those of you who do not know, an ANOVA is essentially a way to compare groups of means against one another. If you’ve ever taken a statistics class, you may remember t-tests, which compare two means specifically. An ANOVA allows you to compare multiple (as in more than two) means. This is pretty basic stuff and there is a significant (hehe, get it?) chance that I’ve already said something incorrectly. Check me!

To get things started, a bit of context again. My thesis data contains measurements of performance in basketball free throw shooting. We asked our basketball playing participants to shoot four groups of ten free throws in four conditions. We’re looking at a 2x2 Within-Subjects Design, with the presence of performance pressure as one predictor and the presence of a free throw routine as the other. 2x2! I’m not going to get into specifics, but that’s the main idea; I need a way to run a 2x2 Within-Subjects ANOVA on R.

Specifically I want to see if the Free Throw Scores are significantly different from one another. For clarity, the four conditions are as follows:

A quick view of the four conditions in this study.

I first checked out the following page: http://www.statmethods.net/stats/anova.html

This was helpful. Sort of. Well, no, it wasn’t. But it did send me to a page that was helpful: https://www.r-bloggers.com/two-way-anova-with-repeated-measures/

Upon reading this, I started to follow along and tried to mimic what the author was doing. The somewhat-abridged step-by-step process follows:

The first thing the author (Chris Weatherill) does is create his own phony data set. As I already have data, I don’t need to do this. However, it appears the form my data takes is not going to work, so I’m going to cheat and manipulate my data in excel rather than R, then I’ll call it up in the R environment when it’s ready. In order to do that, I simply entered the data as one row per participant per condition. According to the article, I should be able to run the ANOVA off of that format.

The first six rows of the data set when the head() function is used.

The data set is now an object in the R environment. Now let’s see if the ANOVA will actually run!

Code for the ANOVA itself.

Okay, so I have some good news and bad news: The ANOVA ran! But, the numbers don’t seem to be the same as the ones I’m familiar with. In my thesis, the f and p-values were different, but did not have statistical significance. In this analysis, there was still no significance. While the same conclusions can be drawn at the end of the day, I cannot, for the life of me, figure out why these results are different from those of SPSS.

However, for the sake of practice, I’ll briefly interpret the results from R.

Output for ANOVA.

The main effect of pressure was not found to be significant [F(1, 48)= 0.309, p=.581].

The main effect of free throw routine was not found to be significant [F(1, 48)= .707, p=.405].

The interaction effect of pressure and free throw routine was not significant [F(1, 48)=.188, p=.677].

According to these results, pressure does not have an effect on free throw shooting accuracy. Likewise, the same can be said for a free throw routine. However, a major limitation of this data is the low sample size (n=14) and statistical power is low.

Obviously something is wrong here, but I wanted to practice. So I will be back shortly to make the necessary corrections!

Show your support

Clapping shows how much you appreciated Anders Orn’s story.