So, we've just looked at generalized linear models or GLM's as generalizations of linear models which are typical anovas. But to responses that are not normal and that allow us to handle response distributions like poisson or multinomial or ordinal responses. As we've said, the linear model generalizes to the generalized linear model. But this generalized linear model, as we said, can only handle between subject's data. Now we're going to introduce what are called mixed models. And there is a linear mixed model, much like the linear model, but now a mixed model, and we'll say what that means in a moment. And then after that, we'll look at its generalization, the generalized linear mixed model. And both of these analyses can handle both between and within subjects data, allowing us to handle data with repeated measures. Which in interaction design and HCI studies, repeated measures come up all the time. So these are very powerful models. Let's set our scenario and then we'll describe more what it means to be a mixed model. Our scenario is that we'll return to our data for our mobile text entry study, where we had people using two different keyboards in three different postures, sitting, standing and walking. You might recall we had 24 subjects, they were in two conditions of keyboard, The iPhone, and the Galaxy. They were in three postures, Sit, stand, and walk. Keyboard was between subjects, postures was within subjects or repeated measures. And, they entered 20 phrases, which we might call a trial which is a general term meaning a sort of single data point that we're going to capture from a subject. Before we averaged their words per minute [SOUND] and their error rate, Across there are 20 phrases within each posture and keyboard. But now, we're going to keep all 20 phrases and thus bring us to, 1440 data points for this data table that we can analyze. So, we're keeping all of the individual phrases that we measure, and not averaging over them anymore. So, that's our scenario, and we'll return to analyze that data shortly. But to do that, we're going to have to introduce the concept of random effects and what we've been working with all along but haven't called them this yet are fixed effects. When you have both of this in a statistical model, you have the mixed term for mixed model which is their generalized linear mixed model and linear mixed model or mixing fixed and random effects. So what are these? Fixed effects are the factors of interest that we manipulate in a study. They've been the kinds of variables, the independent variables, we've looked at all along. Keyboard and posture are fixed effects. They're the factors in our study. Random effects we haven't considered yet. Random effects have a a very special meaning and allow us to use linear mixed in general as linear mixed models. Random effects are factors whose levels were sampled randomly from a larger population about which we wish to generalize, but whose specific level values we actually don't care about. So, in interaction design and HCI studies, subject is a classic random effect. The subjects are sampled from a population of subjects we wish to generalize about and we don't care about the specific levels of the subject factor. They're coded 1, 2, 3, and so on, for however many subjects we may have. Actually we had 24 subjects in this particular study so we'll go with 24. But we don't care about the specific levels. We just care that we have a pool of subjects. They are a classic random effect, and by making them a random effect in our models with otherwise fixed effects, we have linear mixed models, and if we need them, generalized linear mixed models for different kinds of responses. Subject included in the model allows us to correlate measures across the same subjects, across different rows in our data table. And that's how we can handle within subject's designs using mixed models. Mixed models have a number of advantages, and they're very powerful indeed, they can have some missing data cells. If you drop data, you can still use a mixed model approach to analyze that data and it doesn't thwart your study to have some empty cells in your data table. You can also better handle unbalanced designs where you have different amounts of data in different conditions. There's also no longer a Mauchly's sphericity test needed anymore. We don't worry about the sphericity property, we just model the covariance in the data directly. Remember that sphericity is the situation where the variances of the differences between all combinations of levels of a within subject factor are equal, or close to equal. Now, we care about that but we can model sphericity however form it takes. Whatever form it takes directly. What are the disadvantages of using mixed models? I just cited three advantages but what are the disadvantages? Well, really they're just computationally more intensive. Sometimes they can take longer to run. They also retain larger denominator degrees of freedom, what we've seen as the DF residuals or DF denominator. In the F report, we have our numerator here, let's say 2. And our denominator goes here. And for a lot of data and a mixed model, that number may stay fairly large. It may be something for this data like 1,200, we'll see the exact number later. This is a fairly large number and for some people unfamiliar with mixed models who are used to traditional fixed effects models only which have much smaller degrees of freedom. This can sometimes alarm them, make them think perhaps you didn't do the right analysis, but don't be dissuaded. This, in fact, is how mixed models should be working. Now, to do this kind of analysis where we have each of our 20 trials, there's one more item that we have to consider and this comes up a lot with mixed models and that is the idea of nesting. In particular, the idea of nested effects. And it's a practical matter to consider when using mixed models. So what's a nested effect? Well, nesting comes in to play when the levels of a factor shouldn't be pooled just by their label alone. When you're doing any kind of ANOVA analysis, the levels of a factor are grouped together, and calculations are made. For example, for all the set data, stand data, lock data, all the iPhone data, or Galaxy data. In the case of trial as a factor, you'll see in our data table, we'll encode trial just as a number for the 20 trials within each of the sit, stand, walk levels and each of the phone and Galaxy combinations there. Trial takes on values of 1 to 20 throughout the table. But we don't have any special meaning to pooling all of the data for variance calculations for all the trials numbered 1 or numbered 2 or numbered 3. Those levels aren't that important. And we don't want to pool across all levels 1, all levels 2, and all levels 3 because trial number 1 while sitting using an iPhone is very different than trial number 1 while standing using Galaxy. So we nest trial within posture and keyboard. If we're used to dot notation from certain programming languages like Java, you can think of it as a kind of a Keyboard. .Poster.Trial, where trial is kind of nested here. So we would pool values, for example, across, say iPhone while sitting and pool all those trial ones and twos, and so forth. But within iPhone and sitting. In general, when you have a factor like a trial where it's not meaningful to consider them in isolation. Trial 1 by itself doesn't mean very much. You might be in a situation where you want to nest. And that will allow you to get a more accurate response in your results. Let's go now to our R terminal, and we'll carry out linear mixed models on words per minute. And we'll carry out a generalized linear mixed model on error rate. And we'll see nesting happen in the process. We'll do that now.