Introduction
Sometimes, in our projects, we'll want to use a repeated measures design; we'll take the same measure from our subjects at different times or situations. For instance, we might want to measure a person's confidence when they're wearing smart clothes and when they're wearing casual clothes, and compare the two.
Following the golden rule of data entry, we need to make sure that one row is one subject (as each person provides us with a score for both of these levels). So, reading across in our dataset, we'll need a column for each level of data (clothing type) our subjects have provided us with:
Confidence (smart) | Confidence (casual) |
---|---|
5 | 4 |
5 | 3 |
4 | 2 |
So, instead of having one column per variable, we have one column per condition. This is pretty standard in most statistics packages but, despite this, it has a few drawbacks. Firstly, these column names can get very long and difficult to read: Column names such as 'confidence_smart' and 'confidence_casual' aren't too bad, but as soon as we introduce other factors (e.g. 'position'), our column names start to get very long and tedius to read ('confidence_smart_sitting', 'confidence_smart_standing', 'confidence_casual_sitting'. etc).
Fortunately, statscloud has a new, intuitive way of declaring repeated measures designs that makes data sets with these designs much easier to read. As an added bonus, the way statscloud handles repeated measures designs means it's much easier to work with when we're making charts and running analyses. We're going to explore all of that in this tutorial.
Getting started
We're going to create a new project with a repeated measures design using the example above. In this project, we're going to investigate how confident people feel when they wear different types of clothing (smart and casual) and different positions (sitting and standing). So, we'll be working with a 2x2 repeated-measures design.
Task: Start a new project in StatsCloud
- Start a new project in statscloud by visiting https://statscloud.app/new
Setting up the outcome variable
In this project, we have just one outcome variable: the amount of confidence people feel. This will be measured on a 5-point rating scale; from 1 (not at all confident) to 5 (extremely confident). We're going to set up this variable now in the Variables tab.
Task: Add the outcome variable: Confidence
Open up the Variables tab and click the
button to create a new variable. Give this variable the name of Confidence and set up the data type to be Rank. Under the Values section, we want to set up five labels like this:
- Not at all confident
- Not very confident
- Slightly confident
- Quite confident
- Very confident
Attaching related conditions
OK, now we have our outcome variable set up, we can define what related conditions are attached to it. To do this, we simply scroll down to the Related Conditions section and add our factors and levels here. When we do this, our Confidence variable will become split across multiple, related conditions.
In this project, our first factor is Clothing type and it has two levels: Smart and Casual, so we can define those here.
If you click on the
button, you'll see a new factor box appears ready for us to define our factor name, and we can define the levels attached to it in the box below. We can edit the name simply by clicking on 'Factor A', and add new levels by clicking the button.Great! You've now created your first related conditions variable.
Take a moment now to go back to the Data tab and see what our data grid looks like. It looks quite similar to our table above, only now you'll notice that our two levels (Smart and Casual) are nested neatly under one heading of Confidence.
This is much easier to read than the example above; it makes it clear that these two levels both measure confidence, and this heading above means we don't need to have this word in every column title. Let's add a bit more to this now:
And that's our project set up, ready for some data! Just before we add this, let's look at how we can convert old datas sets to this format.
Converting old data sets
As this method of declaring repeated measures variables is unique to StatsCloud, any data you import from other spreadsheet software will be in the old format (one column per variable), much like the table below:
confidence_smart_sitting | confidence_smart_standing | confidence_casual_sitting | confidence_casual_standing |
---|---|---|---|
7 | 4 | 7 | 4 |
5 | 3 | 7 | 4 |
6 | 5 | 7 | 4 |
However, even if the data you want to import is in this format, we can get it into the new, nested statscloud format by using tools in the Variables tab or choosing to nest these columns when we import the data.
Nesting variables from the Variables tab
When you're in the Variables tab, highlight all the columns you would like to combine together (by shift or ctrl-clicking them) and, once they've all selected, right-click on one of them to bring up a context menu. In this menu, you'll see you have an option to _'Convert to Related Conditions'_. When you click on this, a wizard will appear to walk you through this process.
In the first screen, 'Define factors and levels', you can set up your factors and levels just as we did earlier.
In the second screen, 'Assign columns to conditions', we do exactly this. Our individual columns are listed on the left and the new condition 'slots' are available on the right. In this screen, we just move our columns into the correct slots by clicking / tapping on the column we'd like to move into the highlighted slot.
In the third stage, we simply give our outcome variable a name.
Note: If your columns are labelled in an appropriate format like above (e.g. your outcome name and factor level names appear in the column titles), statscloud will be able to identify these for you and assign your columns to slots based on these names automatically. If the outcome name appears in every column, statscloud will be able to identify this and declare your outcome variable name too. You'll still need to provide a name for your factors (in stage 1) though as this information won't be included in your column titles!
Nesting variables when importing data
You can also choose to nest your variables as soon as you import them into your project. Once you've chosen the file to import you'll be greeted with a pop-up asking you how you would like your data set to appear.
Task: Nest your variables when you import your data
- Download the data set here.csv)
- Create a blank project in statscloud by visiting https://statscloud.app/new. Import the data you have just downloaded and, when you see the prompt, select the option to import your data with 'Nested columns'
Data restructuring
So far, we've assumed that our data is in wide format. When the data is in wide format, one row is one subject and each of our related conditions make up one column each. Hence, our data set will be presented as it was above:
confidence_smart_sitting | confidence_smart_standing | confidence_casual_sitting | confidence_casual_standing |
---|---|---|---|
7 | 4 | 7 | 4 |
5 | 3 | 7 | 4 |
An alternative data format is long format. When the data is in long format, we have just one column for our outcome variable (in this case, confidence), and we have a column for each of our factors (in this case, clothing and position). The data above will there look like this:
Clothing | Position | Confidence |
---|---|---|
smart | sitting | 7 |
smart | sitting | 4 |
casual | sitting | 7 |
casual | sitting | 4 |
smart | sitting | 5 |
smart | sitting | 3 |
casual | sitting | 7 |
casual | sitting | 4 |
This should demonstrate nicely why the two formats are called wide and long!
In StatsCloud, the difference between wide and long formats is just cosmetic; some people prefer to view their data in wide format, and others prefer it in long format. Fortunately, in StatsCloud, there's an easy way to toggle between the two; we just use the 'data restructure' switch!
Task: Toggle between wide and long data formats.
With your data set up with nested conditions, simply click on the long/wide toggle switch in the toolbar (on desktops) or click on the 'View' menu and then choose 'long' or 'wide' (on touch devices).
Advantages of nesting your conditions
One of the great advantages of nesting your conditions from the start is that it makes creating and charts and running analyses much easier. When you run an analysis in other statistics packages, you'll need to set up your factors and levels and assign them to conditions every time you want to create a new chart or run a new analysis. This isn't an issue when you're using statscloud and here we'll see why!
Creating charts
We want to create a chart that shows the mean scores of confidence across all four of our conditions. To do this, we simply to the Charts tab, click to add a new chart and select a chart. For this example, we'll go with a simple bar chart.
In the variables selection screen, all we need to do is select 'Confidence' as our measure. That's it! statscloud already knows there are four conditions attached to the 'Confidence' variable so, when we ask to create a chart using this data, it creates the columns for us automatically. We don't need to do anything!
Task: Create a line chart for the Confidence data
With your current project open, create a new chart using the instructions above. Try creating a line chart this time.
Running analyses
The same advantages when creating charts extend to running analyses too. If we want to consider whether there are any significant differences between our factors (using a repeated-measures ANOVA), we can run an analysis testing this in exactly the same way.
We start a new analysis by going to the "Analyes" tab and clicking 'Run new analysis'. Select 'ANOVA' (under Compare groups of groups in the Differences column) and select 'Confidence' as the measured variable just as before.
Task: Run an ANOVA on the Confidence data.
With your current project open, run an ANOVA using the instructions above.
Recap
This tutorial should have shown you the benefits of StatsCloud's unique way of setting up repeated measures variables. Here's what we've covered in this tutorial:
- How to set up a new project that uses a repeated measures design
- How to convert projects with the old format into the new format
- How to toggle between wide and long data views
- How to create a chart with a repeated measures design
- How to run an analysis with a repeated measures design