# Introduction

## What it is A case study where we have a number of judges and each one rates 4 different wines taken from Dr. Parris's Slides from Module 2.8.

A One Factor Repeated Measures design is when we make many observations from the same unit under different conditions. This design is also known as a within subject factor or a repeated factor. While there are many other ways to conduct this type of test (such as Multivariable Analysis of Variance), in our discussion, we will be using the Linear Mixed Model (REML/ML). Just bare in mind that this particular model is very computational heavy -meaning that it requires a statistical program to be used quickly and efficiently.

In Dr. Parris's example, he used a wine study where we asked judges to rate four different wines. Now note that a score from Judge 1 is dependent on the other scores the judge has made. This has actually violated our GLM Distributional Assumption, which causes much debate about these types of tests (and hence why we have different ways of testing a One Factor Repeated Measures).

## Population Model vs Sample Model One Factor Repeated Measures Model Sample Model from Dr. Parris's Slides from Module 2.8 One Factor Repeated Measures Model Sample Model Dr. Parris's Slides from Module 2.8

Y(ij) is what we are trying to observe. This is equal to the summation of:
μ.. or the grand population mean
ρ(i) or the overall offset for the individual i (in this case study, the judges)
τ(j) or the treatment offset for the for level j (in this case study, the wine)
ε(ij) or the error.

Something to note about the ε(ij)is that is actually is (ρτ)(ij), the interaction between ρ and τ. In other words, ε is to what degree does one factor's effect depend on the level of the other factor.

As always, we simply substitute the Greek letters with Roman letters when we are looking at a sample.
So μ..=Y.. ρ(i)=r(i) τ(j)=t(j) and finally, ε(ij)=e(ij).

## Fixed vs. Random Factors

A fixed factor is when the levels observed in the study represent the actual levels of experimental interest. For this factor, we actually care about the outcome and if they represent the population. Now compared that to a random factor, which is when the levels observed in the study represent a sample from all the possible levels. In our wine study example, judges are the random factors and wines are the fixed factor. The reason is because if we are to replicate the study, Judge 1 for study 1 won't be the same Judge 1 in study 2. Their scores will be different, but we don't really care about it as they only represent a sample of all possible levels.

# Understanding and Interpreting The Data

## Visualizing the effect of modeling individual subject offsets

When we look at the magnitude of effects, we can do it relative to the variability of observations around that effect. In other words, when there are considerable spreads between the averages, we can remove the variability of the data by centering the data around each subject's set points. Basically, ask, how much above or below the mean is a datum relative to other data for this specific subject?
The first slide provides a visual explanation on how between-subject variability is removed.
The second slide provides a visual representation of after getting stability of effect.
Note that our model does not actually do individual subtraction -- that was just a conceptual way to explain removing between-subject variability. Instead, our models will be estimating the variance of each random levels independently of the level of fixed levels.

## The Subject x Treatment Interaction Source as Error

Does the effect of treatment depend on the subject? In our wine example, does the effect of wine depend on which judge is making the rating? This is an error term we should examine, because if treatment depends greatly on the subject, that gives us no reason to believe that the effect of treatment is stable. This interaction between subjects and treatment would be the error term we should examine.

## Data Arrangements, Stacked and Split Data

There are two ways to represent data:
1. Split: observations from the same unit are represented across columns
How to split data columns: Tables > Split -- choose the column that you'd like to split
2. Stacked: observations from the same unit are represented across rows
How to stack data columns: Tables > Stack -- choose the columns that you’d like to stack and feel free to change the column labels by editing their names

# Analyze Using Fit Model

Once all of the data has been checked in the "Analyze- Distribution" platform, you are ready to use the "Fit Model" platform to analyze this one factor repeated measures test. Recall the formula for One Factor repeated Measurements: Yij = μ + ρi + τj + εij. The μ is the intercept and can be turned off in JMP, though we won't ever do that in this class, the ρ is the subject firm, the τ is the treatment, and ε is our error but we don't include it in the set up because JMP already computed for it.

## Setting Up Your Fit Model

1) Cast the correct term into your Y role. In the example we are using involving wine, we use the "Rating" term in the Y role.

2) Immediately change the Emphasis in the sidebar to "Minimal Report".

3) Put the ρ's and τ's, or in this example the "Judge" and "Wine", in the "Model Effects".

4) Because JMP assumes a fixed effect, we need to be weary of random effects. "Judge", in this case, is a random effect. To change it to a random, click on it, go to "Attributes", and click "Random".

5) Finally, with the "Random" addition, change the "Method to "REML". REML is very intense and we just need to know we should use it in this case.

## Analysis of Fit Model Output

Before going too deep into analysis, know a few things. First, analyzing repeated measures in the Fit Model output is, for all intensive purposes, the same as any other Fit Model output. Next, notice that there are a few new sections.

1) Look at the "Fixed Effects Test" section to see if there was an overall main effect.

2) Open up the "Effects Test" and look at any relevant LS Means Plot's and do any necessary follow-up pairwise comparisons.

3) Observe the new sections: "Random Effect Predictors" and "REML variance Component Estimates"

-Random Effect Predictors: A BLUP is a "Best Linear Unbiased Prediction", but otherwise this section isn't used much

-REML variance Component Estimates: This tells us the spread of variability, specifically with the "Random" variable present

## JMP Full Factorial Repeated Measures Add-In

This add-in is extremely helpful. Instead of always walking through the steps it takes to designate a "random" effect like we just saw in the section above, this add-in allows us to much more easily navigate the set-up for our Fit Model.

Again, we have a Y role which stays the same, and in this case is, again, "Rating". There are also three new sections: Within-Subjects, Between Subjects, and Subject ID. These sections are intuitive and will help us keep things straight. For this example we cast "Wine" into Within-Subjects and "Judge" into Subject ID. When we run this, our output is identical. In face, Julian made it even easier by hiding the "Parameter Estimates" and "Random Effect Predictions" sections that we don't use.