Psychology 815:Computer Lab #12
Plotting means/SDs and running a power analysis
December 6, 1996


Objectives:

     1) Plotting means and standard deviations

     2) Power analysis

     3) Enjoy your winter vacation

Objective 1: Plotting means and standard deviations

This is the last data set that you will need to type in.  At the suggestion of several students, when

it is necessary to use data that you do not already have, I will have the data available for you to

download from the web.  In the meantime, I tried to keep it short.  Here's the data with the

appropriate INPUT statement.



1   0 10  45

2   0 15  44

3   0 20  43

4   0 10  47

5   0 15  48

6   0 20  49

7   1 10  52

8   1 15  53

9   1 20  54

10  1 10  56

11  1 15  58

12  1 20  59

13  2 10  61

14  2 15  62

15  2 20  63

16  2 10  64

17  2 15  65

18  2 20  59

;



Ok, here is the SAS code to plot a graph of the means and standard deviations.  Don't be

intimidated.  Much of the program is formatting.  I'll go over the details in class.



GOPTIONS RESET=ALL LFACTOR = 4 TARGET=WINPRTG ROTATE=PORTRAIT;

SYMBOL1 INTERPOL=STDMTJ MODE = INCLUDE LINE = 1 CI = NONE;  /* +1 1 STANDARD

ERROR BARS */

                                                            /*REMOVE M TO GET +- 1 SD BAS */



LEGEND1 POSITION = (BOTTOM INSIDE LEFT) FRAME MODE = PROTECT OFFSET=(2)

        LABEL = (FONT=SWISSB HEIGHT = 1.5 'GOAL')

        VALUE = (FONT=SWISSB HEIGHT = 1.0 '8 POINTS' '12 POINTS' 'DO YOUR BEST');

AXIS1 MINOR = NONE ORDER=(1, 2, 3, 4) OFFSET=(2) LENGTH = 80

         LABEL =  (FONT=SWISSB HEIGHT= 2.0 "BLOCK")

         VALUE =  (FONT=SWISSB HEIGHT = 1.3);



AXIS2 ORDER=(0 TO 30 BY 5) OFFSET = (3)  LENGTH = 65

         LABEL =  (FONT=SWISSB HEIGHT= 2.0 ANGLE=90 "MEAN ABSOLUTE ERROR")

         VALUE = (FONT = SWISSB HEIGHT = 1.3);



 PROC GPLOT;

        PLOT depvar*age/VAXIS=AXIS2 HAXIS=AXIS1 LEGEND=LEGEND1;

  RUN;




Objective 2: Power analysis

     Let's say that you are designing a study.  Fortunately, you are a smart researcher and you

have already gathered some information.  You know that you will want to do a two-tailed test.

You also know that you want your power to be .90.  In fact, you even have an idea regarding the

effect size.  What you don't know is how large a sample you need for such a study.

     Well, your worries are over.  This objective will show you how to figure out the required

sample size, if you know the type of test (one-tail or two-tail), the power, and the correlation

(effect size).  This is called a power analysis.  It is first done by transforming r to a z-score, which

is then used to determine the approximate sample size.

     Using the information provided below, write a SAS program that computes the

approximate sample for the following parameters:



power = .85; 2-tailed test; r = .10

power = .85; 2-tailed test; r = .23

power = .85; 2-tailed test; r = .35

power = .90; 2-tailed test; r = .10

power = .95; 2-tailed test; r = .23

power = .99; 2-tailed test; r = .35



* FISHER TRANSFORMATION FROM  R TO Z;

z=.5*(LOG((1+r)/(1-r)));



* FORMULA FOR APPROXIMATE SAMPLE SIZE;

N=(N10*(.100/Z)**2)+2;



You will also need the following table, which should also be part of your SAS program.



* TABLE 25C-2 (ALPHA=.05 FOR A TWO-TAILED TEST - SEE COHEN, 1988, PG. 102);



POWER=.80      TAIL=1    N10=617;

POWER=.80      TAIL=2    N10=783;

POWER=.85      TAIL=1    N10=717;

POWER=.85      TAIL=2    N10=895;

POWER=.90      TAIL=1    N10=854;

POWER=.90      TAIL=2    N10=1047;

POWER=.95      TAIL=1    N10=1078;

POWER=.95      TAIL=2    N10=1294;

POWER=.99      TAIL=1    N10=1570;

POWER=.99      TAIL=2    N10=1828;




Objective 3: Enjoy your winter vacation

Sorry, I don't seem to have the program for this particular objective, but I'm sure that you guys can figure it out on your own :) Good luck on exams!