* This program generates a set of data which have been drawn from populations having the * pattern of correlations specified in "Compute R = { }. * If you ran a Principal Components analysis and extracted all factors, and then entered * these factors in the Matrix statements (in place of r1, r2, ...), then the output variables * would have EXACTLY the pattern of correlations given in R. * David C. Howell * 2/20/98 * Last revised 2/15/99 new file. input program. * Draw 200 cases. *SET SEED 3458769. loop #i = 1 to 200. *Draw data for 4 variables. do repeat response = r1 to r4. COMPUTE response = rv.normal(0,1). end repeat. end case. end loop. end file. end input program. Save outfile = "DataOut.sav" /Keep = r1 to r4. Matrix. Get X/var = r1 to r4. * Define the desired pattern of correlations. Compute R = {1, .6, .6, .6; .6, 1, .6, .6; .6, .6, 1, .6; .6, .6, .6, 1}. Compute NewX = X*chol(R). * Save NewX as the working file. Save NewX /outfile = */variables = epineph1 to epineph4. End Matrix. IF ($casenum le 100) Location = 1 . EXECUTE . IF ($casenum gt 100) Location = 2 . EXECUTE . *The following prints the correlations for the original variables. CORRELATIONS /VARIABLES= epineph1 to epineph4 /PRINT=TWOTAIL SIG /MISSING=PAIRWISE . *Now modify the data to build in an effect. If Location = 1 epineph1 = epineph1*153.4 + 229.2. If Location = 1 epineph2 = epineph2*130.4 + 328.1. If Location = 1 epineph3 = epineph3*168.1 + 341.9. If Location = 1 epineph4 = epineph4*150.0 + 340.0. If Location = 2 epineph1 = epineph1*57.0 + 251.8. If Location = 2 epineph2 = epineph2*64.6 + 280.9. if Location = 2 epineph3 = epineph3*83.7 + 246.2. if Location = 2 epineph4 = epineph4*75.0 + 253.5. Save outfile = "DataOut.sav"