# Lab on t, Power, and Correlation

## David C. Howell

This lab is intended to serve several purposes. In the first place, it is another look at the t test, which you probably don't need. In the second, it looks at the power of the t test, and in the third, it looks at correlation. The basic idea is that we will generate (five sets of) two columns of data with a specified correlation between them. (The only reason why you are creating five sets instead of one is to allow for replication. We will pool the replicates and have about 75 values of t.) Think of the first variable in each set as a pre-score for aggressive behavior, and the second as a post-treatment score on aggressive behavior after an intervention. We will make the data come out with a mean of approximately 15 and a standard deviation of approximately 5, although these could be made to be anything.

We will first generate the data, and run paired-sample t tests, under the situation where the null hypothesis is true. Each of you will first create these data sets where the population correlation between the two variables is .85, and then do it all over again with a population correlation of.35. I want you to see what happens to the test as we vary the correlation between pre- and post-scores. For each correlation (.35 or .85) I want you to record the sample correlation so that you can see how it, too, varies from sample to sample.

We will then repeat all of the above, yet again, under the condition that the null hypothesis is false. In this case we will let one mean = 16.55 and the other = 15, which is about one-third of a standard deviation difference between the means. In Chapter Eight I give a formula for the calculation of the power of this test as

You already know the population means, the (common) population standard deviation, and the population correlation, so you can easily calculate d and = dÃN. You can then use the table I will pass around to calculate the power of the test for the condition where = .35 and = .85. You can also see how well this estimate of power corresponds to the results that you actually receive, by pooling all of your t values and noting how often you rejected H0.

To generate the data for these exercises, use the syntax given below. I will show you how to open a syntax window, enter the commands, and run the program. Then all you have to do is to write down the results.

The Basic Program

```
*This program draws 5 sets of pre- and post-scores with a predetermined

population correlation between them and with known populations

means and

standard deviations.

*BEFORE RUNNING THIS FOR THE FIRST TIME, go to Transform/Random

number seed and enter a 9 digit number of your choice. You will have to first

add at least one observation to the data sheet to do this.

new file.

input program.

* Draw 30 cases.

loop #1 = 1 to 30.

*Draw data for 10 variables.

do repeat response = r1 to r10.

compute response = rv.normal(0,1).

end repeat.

end case.

end loop.

end file.

end input program.

save outfile = "Calvin:data103196.spss." /keep r1 to

r10.

```

*Now create a correlation of rho between pre- and post-scores. Compute rho = .35. Compute r2 = r1*rho + r2*sqrt(1 - rho**2). Compute r4 = r3*rho + r4*sqrt(1 - rho**2). Compute r6 = r5*rho + r6*sqrt(1 - rho**2). Compute r8 = r7*rho + r8*sqrt(1 - rho**2). Compute r10 = r9*rho + r10*sqrt(1 - rho**2).

*Now make the population means = 15 and population sd = 5. do repeat response = r1 to r10. compute response = response*5 + 15. end repeat.

Add the following code later when you want to make the means different. Compute r1 = r1 + 1.5. Compute r3 = r3 + 1.5. Compute r5 = r5 + 1.5. Compute r7 = r7 + 1.5. Compute r9 = r9 + 1.5.

*Run the t tests. T-TEST PAIRS= r1 r3 r5 r7 r10 WITH r2 r4 r6 r8 r9 (PAIRED) /CRITERIA=CIN(.95) /FORMAT=LABELS /MISSING=ANALYSIS.

In the process of doing this assignment, you will produce a bunch of numbers. Enter them on this sheet in the appropriate place.

Power when µ1 - µ2 = 1.5 and rho = .85 --------

Power when µ1 - µ2 = 1.5 and rho = .35 --------

 Diff/rho t1 t2 t3 t4 t5 r1 r2 r3 r4 r5 0.0/.85 . . . . . . . . . . 0.0/.35 . . . . . . . . . . 1.5/.85 . . . . . . . . . . 1.5/.35 . . . . . . . . . .

Send mail to: David.Howell@uvm.edu)

Last revised: 7/11/98