0:05

Okay. So,

we're looking at our study of people using two different keyboards.

And they use one or the other.

The iPhone keyboard or the Galaxy keyboard in three different postures.

And they do all three postures, sitting, standing, and walking,

which we fully counterbalanced.

We had the parametric analysis, was a mixed factorial ANOVA,

because we have a between and within subjects factor.

And we saw this interaction plot here, and we found that we have differences at each

of the two keyboards and each of the postures were different.

How do we do this with a non parametric procedure?

Well, let's look at the error rate data.

Errors almost invariably do not conform to the assumptions

that we discussed for ANOVA.

0:51

They are cut off at zero.

They can't sort of be less than zero obviously.

They often are kind of random in their distribution.

Errors just tend to not

sort of allow themselves to be analyzed easily with parametric procedures.

So, we can use a non parametric procedure on our error rate column.

And we'll do that with an approach called the aligned rank transform procedure.

It's important to note that with non parametric analysis,

interaction effects are not usually available in the common analysis.

Friedman tests that we've looked at, Wilcoxon signed-rank test.

Kruskal-Wallis test and Mann-Whitney test, they're all one-way tests.

They're just single factor tests.

So if we want the possibility of analyzing interactions and handling those the right

way, one of the options available to us is called the aligned rank transform.

I won't go into great depth about how this works but it does operate on

ranks just like the other non parametric tests we've seen.

But it operates on something called aligned ranks

where the data is aligned before being ranked.

And what aligned means is that only the effect of interest is left in the data,

because we subtract out values from it.

That remove the possibility of other effects.

So, for example, if we're just looking at a main effective keyboard, we align

the data to that by subtracting out possible estimated effects of posture.

If we want to look just at the interaction between keyboard and

posture, we subtract out estimated values from each data point

that would relate to the main effects of keyboard and posture.

So we just leave one effect behind and that's called the alignment process.

You're welcome to look that up more online.

2:36

So we'll do our usual approach of exploring the data first.

So here we have the different means and

medians for the error rates, in the different conditions.

And here we have our summary that gives us means and standard deviations of the same.

Obviously these are somewhat easier to interpret with a box plot, so

we'll work our way there.

Let's get a sense first of the shape of the data.

And we can see that with the iPhone sitting condition,

standing condition, walking condition.

And then with the Galaxy sitting, standing, and walking.

Very different shapes of the data obviously.

A box plug helps us see that it looks, at first glance that while sitting,

the errors, these two plots are lower.

The error rate's lower, that makes sense.

And then when we stand up, the error rate goes up a bit with both keyboards.

And then when we're walking, the error rate goes up even more, but

seemingly deferentially between the two keyboards, where they stay more the same.

So that might suggest we have an interaction effect.

3:52

And here, we have an obviously very interesting result.

It looks like when walking, the Galaxy keyboard for

whatever reason is more error prone than the iPhone keyboard which

obviously would be a very interesting finding.

And it's completely fictitious to this example.

So, let's go ahead and look at the error rate result.

So, we load a library called the ARTool library,

and that gives the aligned rank transform.

4:19

And we build a model, as we've done before, using the ART command.

We formulate our model like we've seen, where we have our Y on the left.

Keyboard by posture is our study, and

we add this term in parenthesis one with a vertical bar and subject.

This is because the aligned rank transform,

the ART procedure under the hood here is using a linear mixed model.

We're not going to discuss that right now.

That'll be a topic later in the course.

But that's what that means and that's what's going on under the hood.

This notation is part of what tells it that subject is a random effect.

Again, we'll discuss that later, but also helps it know that subject is what to

use to correlate data across rows in our table.

So, let's go ahead and build that and then we'll report the ANOVA result.

Now remember, even though this isn't ANOVA.

It is a non parametric result, because the ART procedure used

the aligned rank transform on all of the data to build that model.

So that's what allows us to see interactions in an F test,

is how we'd report this, just like you've seen before,

but it's really a non parametric result.

Okay, so with this, we see that we have our F statistics for

keyboard posture and the interaction.

The degrees of freedom in the numerator as you've seen before.

And then the residual or denominator degrees of freedom.

And we see that all three results are statistically significant.

What that means is, for

all three main effects in the, or two main effects in the interaction.

We have statistically significant results.

It seems there's a main effective keyboard, a main effective posture and

we can tell from just looking at the graph obviously a significant interaction.

We can just for fun here,

test the normality of the residuals that the model provides.

Remember that one of the ANOVA assumptions is normality and specifically,

the normality of the residuals which are the difference and

the observations from the model predictions.

So we'll use our Shapiro–Wilk test.

And even though this is a non parametric test, we're ultimately still doing

an ANOVA, and so it would be nice to see that the residuals comply with normality.

The Shapiro-Wilk test is non significant, telling us that we don't have

a significant departure from normality, so that's nice to see.

And we can graph the residuals on a QQ plot as we've done in the past, and

see that the data points do seem to fall roughly equal to or

random around the normal line.

Which is the normal distribution line.

So that's good, so it seems that were conforming to the assumptions there

of ANOVA which can make us proceed with confidence.

So given the overall significant interaction effects and main effects here,

we can look a little bit further into pairwise comparisons.

Where do the differences lie?

One thing we might notice is in the sitting situation and the standing

situation, things between the keyboards don't seem to be all that different.

But in the walking situation, we see that they are quite different.

So that's going to be interesting for us to see.

7:59

are in contrasts where we see the Galaxy and the iPhone comparison.

So it's a comparison there.

And, we can see that it's a T-test between those.

We can also check the pairwise.

So we should say with the keyboard, this is equivalent to the main effect

because there are only two levels of keyboard.

So we just included that kind for completeness.

If we want to do the pairwise comparisons among the levels of posture,

we can do that.

And in the contrast table, we see sitting versus standing, sitting versus walking,

and standing versus walking.

And they're all significant.

So imagine a line drawn between these lines for that posture effect.

So it would be kind of moving from sitting to standing,

and then going up between them in the middle for walking.

Since they're not horizontal, there's clearly effects here of posture overall.

9:01

Now, that approach to contrast testing that we've just done, can't be used for

the interaction.

So, I have a commented outline here saying, don't do this.

Where we'd specify the interaction directly and

do a pairwise comparison across factors.

The reason we can't do this with the ART approach,

the aligned rate transform approach, is that we can't compare

pairwise values across factors directly.

And that gets to some very deep statistical

9:35

research that we've done looking into that.

And you're welcome to look that up.

If you look up the vignette, which is an R command for

bringing up more information, beyond just the help page.

Look up the vignette for ART contrast, you'll be able to read further.

The good news is there's another way to do contrast

that results in something called interaction contrasts.

And it's looking at the difference of differences.

And that is usable with the ART approach.

And we get that from the FIA library, so we'll load that.

There's some notes here explaining how to interpret these things.

10:25

So what we see in this table is not just the usual comparison of levels.

We see Galaxy-iPhone on the left and then a colon and then sit-stand,

sit-walk and stand-walk on the right.

Well, what does that mean?

So let's look at our comment here.

In the output,

A-B colon C-D is interpreted as a difference of differences.

In other words, the difference between A and

B given C, and the difference of A and B given D.

So in other words, is the difference between A and

B significantly different in condition C from condition D?

So that'd be kind of the general interpretation.

So let's apply that here.

So we're saying that, is the Galaxy versus the iPhone given the sitting posture,

so given the sitting posture of the Galaxy versus the iPhone.

Is that difference significantly different from the Galaxy versus

the iPhone in the standing situation?

So there are difference here.

And that is not statistically significant with a chi-squared test.

And so, that's saying that the difference we see here,

which is obviously very minimal between the keyboards, and

the difference we see here which is only slightly bigger.

Those differences are really not significantly different.

12:08

So, now we've analyzed this data in two different ways.

Let's go ahead and take a look at our analysis table and

see where this has brought us.

Okay, so

we've just completed our analysis of our mobile text entry

data with smartphone keyboards, the iPhone keyboard and the Samsung Galaxy keyboard.

And also in three different postures, sitting, standing, and walking.

So we looked at a factorial ANOVA, in our case, a mixed design with a between and

within subjects factor.

So let's see the red text in our table here, and

notice that its the first time we've had more than one factor.

We see that in our left column.

We had also, we had factors with more than two levels.

So we had a posture within subjects or

repeated measures factor that had three levels.

Sitting, standing, and walking.

13:05

We had a between subjects factor, and we also had a within subjects factor.

So, we have some highlighted analysis in two different rows.

We could have a purely between subjects factorial ANOVA,

with all between subjects factors.

We could also have a purely within subjects ANOVA with all within subjects

factors, and the analysis is very much like what we've just carried out.

We did a mixed design analysis so we could see how to handle both between and

within subjects factors.

So for a parametric test,

we've covered factorial ANOVAs, and because we had a within subjects factor,

we've actually covered factorial repeated measures ANOVAs as well.