G89.2247 Lecture 2 www.psych.nyu.edu/couples/G2247 Repeated Measures Analysis: An Example Math tools: Notation Expectations Matrix operations ANOVA approaches Example Revisited G89.2247 Lecture 2
Repeated Measures Analysis: An Example 68 persons preparing for the bar exam provided information about anxiety in the month prior to the exam We calculated for each person four weekly POMS anxiety scores Here is a summary of the results that does not take advantage of the repeated measures. G89.2247 Lecture 2
A one sample test of change (2 time points) Could the scores from week 4 differ from those in week 3 simply by sampling fluctuations? One sample (paired) t test problem Call Time 4, Y4 and Time 3, Y3 Formal Statement Let D = Y4-Y3 H0 : Compare the sample mean of D with the standard error of D. Under usual assumptions, the ratio is distributed as a t statistic. G89.2247 Lecture 2
Practical Computation Means, (SD, SE) Sample of 68 respondents T3 = 1.658 (.888, .108) T4 = 1.979 (.897, .109) D = 0.321 (.493, .060) "Paired" or "One sample" t test t(df=67) = (.321/.060) = 5.35 Under the null hypothesis that the true mean difference is zero, this value of t is very unusual. We "reject H0 " and conclude that on the average, true change occurred. G89.2247 Lecture 2
A two sample comparison of change A comparison group with no upcoming exam G89.2247 Lecture 2
A two sample comparison of change One could ask whether merely filling our a daily diary makes one more sensitive to moods, and perhaps induces change A comparison group was recruited via paper and e-mail postings, and couples were recruited. Complete data were available for 67 persons One can compare the two trajectories G89.2247 Lecture 2
A two sample comparison of change Formal analysis might ask: Do the groups differ in their average anxiety? On the average, across groups, is there an effect of time? Does the effect of time vary across the two groups? Choices of analysis include Mixed model ANOVA (groups, time fixed, persons within groups random) Contrast-based trajectory ANOVA Multivariate ANOVA G89.2247 Lecture 2
Some notation We need to keep track of which anxiety scores come from different persons and times, and which persons come from different groups Different texts use different notation We will include a glossary in each lecture Diggle, Liang and Zeger Yhij h is group, ranging from 1 to g (g=2 here) i is individual, ranging from 1 to mh (m1=68, m2=67) j is time, ranging from 1 to n (n=4 here) G89.2247 Lecture 2
Math tools: Expectations Yhij is a random variable It is often useful to think about the distribution of random variables before we collect data A Random Variable can be thought to be a blank cell in a spreadsheet, waiting for an observation The numbers that go there have a distribution Lower and upper values Expected average Expected variability G89.2247 Lecture 2
Rules for Expectation operators E(X)=mx is the first moment, the mean Let k represent some constant number (not random) E(k*X) = k*E(X) = k*mx E(X+k) = E(X)+k = mx+k Let Y represent another random variable (perhaps related to X) E(X+Y) = E(X)+E(Y) = mx + my E(X-Y) = E(X)-E(Y) = mx - my Putting these together E(`X) = E[(X1+X2)/2] =(m1 + m2)/2 = m The expected value of the average of two random variables is the average of their means. G89.2247 Lecture 2
Variance Expectations E[(X-mx)2] = V(X) = sx2 Let k represent some constant number (not random) V(k*X) = k2*V(X) = k2*sx2 V(X+k) = V(X) = sx2 Let Y represent another random variable that is independent of X V(X+Y) = V(X)+V(Y) = sx2 + sy2 V(X-Y) = V(X)+V(Y) = sx2 + sy2 More generally, let Y and X be two random variables with known covariance, Cov(X,Y) = E[(X-mx)(Y-my)] = sx sy rxy V(aX+bY) = a2 V(X)+b2 V(Y) + 2ab Cov(X,Y) = a2 sx2 +b2 sy2 + 2ab sx sy rxy G89.2247 Lecture 2
Numerical Example Means, Var and SD in Sample of 68 examinees Y1•3 = 1.658, .789, .888 Y1•4 = 1.979, .805, .897 If I added 10 to each POMS score the results would be Y1•3 = 11.658, .789, .888 Y1•4 = 11.979, .805, .897 If, instead, I multiplied each score by 10, the results would be Y1•3 = 16.58, 78.9, 8.88 Y1•4 = 19.79, 80.5, 8.97 G89.2247 Lecture 2
Math tools: Vectors and Matrices With multiple time points, and multiple persons, the notation can get cumbersome It is often convenient to use lists of numbers for each person (or each variable) Lists are called vectors Lists of vectors are arrays called matrices E.g. G89.2247 Lecture 2
Vector definition & operations Definition: A vector is an ordered list of numbers: aT = [a1 a2 ... ap] Transpose If a is a vector with p elements in a column, then aT is a vector with the same elements arranged in a row. Vector Addition If a and b are two vectors with p elements, (ai, bi), then a+b is a new vector with elements given the the respective element sums. [a+b]i = [ai + bi] G89.2247 Lecture 2
Vector Operations, Continued Vector Multiplication If a and b are two vectors with p elements, (ai, bi) then aTb = S aibi = a1b1+a2b2+... + apbp Example aT = [0 0 –1 1] Y = [Y1 Y2 Y3 Y4] Then, aTY = Y4 – Y3 This is an example of a contrast vector G89.2247 Lecture 2
Matrix operations Matrix definitions Matrix Addition A matrix can be viewed as a collection of vectors E.g.. a data matrix is made up of n rows of p variables The transpose of a matrix makes rows columns and vice versa Matrix Addition [A+B]ij = [aij + bij] Matrix Subtraction [A-B]ij = [aij - bij] G89.2247 Lecture 2
Matrix Multiplication An Identity matrix, I, is a square matrix with ones on the diagonal and zeros on the off diagonal A*I = A If a matrix A is square and full rank (nonsingular), then its inverse A-1 exists such that A*A-1 = I G89.2247 Lecture 2
Some facts about matrix multiplication In general, AB ~= BA Commutative principle does not hold When A and B are square and full rank (A*B)-1 = B-1*A-1 Distributive principle holds A(B+C) = AB + AC A matrix A can be multiplied by a single number, called a scalar, which sets the unit of the new matrix: kA = [kAij] G89.2247 Lecture 2
Return to Repeated Measures We have two groups, each with its own profile of scores over the four time points. G89.2247 Lecture 2
Two Group Problem Perhaps the groups differ only because of chance sampling fluctuations This null hypothesis is multivariate Multivariate tests can be used to provide an omnibus assessment of the null hypothesis The test does not take into account the ordering of the variables Corresponding univariate results describe group differences for each time point G89.2247 Lecture 2
Transformed Multivariate Problem Just as we looked at the difference between times 3 and 4 in the first example, we can consider contrasts of all four time points that reflect the change process Traditionally, we transform into so-called polynomial trends Constant Linear Quadratic Cubic G89.2247 Lecture 2
Transformed Problem The transformed variables are just difference scores We can now ask whether the groups differ in Constant Linear Quadratic Cubic We can also ask a new multivariate question: Do the groups differ in the pattern of change over time? This omnibus test combines linear, quadratic and cubic variables in a new test G89.2247 Lecture 2
Mixed Model Approach All of the approaches so far considered subject as the unit of analysis Error degrees of freedom were functions of 68+67=135 observations Another approach combines the repeated measure information with the between subject information An important issue is how the nonindependence of the data is taken into account G89.2247 Lecture 2
The Mixed Model We consider the model where m is the overall mean b is the group effect a is the time effect g is the time by group effect U is the effect of random subject I in group h Z is the random residual We assume the residuals are independent! G89.2247 Lecture 2