Multi-to-Uni.txt Repeated Measures Designs: Converting a Multivariate Data Setup to a Univariate Data Setup Bob Wendling in Leisure System Studies collected data designed to determine whether persons prefer interpretative messages (explanatory text accompanying a display of some interesting piece of natural history) with many personal words (like 'you'), or no personal words. For each of several such displays each subject read a personal interpretative message, a nonpersonal interpretative message, and a blank message (no text accompanying the display), and then ordered the three in terms of preference (1 = most preferred, 2 = intermediate, 3 = least preferred). Type of message is a three-level repeated measures variable. Preference ranks were summed across several objects for each subject and are in the data file "WENDLING DATA." In cols 1-2 are subject id's (0 to 36), in cols 3-4 are preference sums for the nonpersonal messages, in cols 5-6 for the blank messages, and in cols 7-8 for the personal messages. The higher the score the lower the preference. "WENDLING SAS" (appended)reads this data file, obtains univariate stats on the preference scores, and does both multivariate and univariate repeated measures analyses of variance. Inspection of the output from PROC UNIVARIATE reveals problems with skewness that cannot be easily resolved with data transformations (positive skewness in one group, negative in another), so I decided to use a nonparametric analysis, the FRIEDMAN test. I like to use MINITAB for such an analysis, but Minitab wants the data to be in a univariate setup for a Friedman test. The setup we have in the wendling data file is a multivariate setup, all of each subject's scores (for all three conditions) being on a single line. In the second part of the program I use a DO OVER ARRAY to transform the multivariate data setup to a univariate setup. PROC PRINT is used just to print the univariate setup data so you can see what it looks like in that form. The last part of the program PUTs the univariate setup data into a file (that goes to the reader) that can be read into Minitab to do the Friedman test. <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> We collected data designed to determine whether persons prefer interpretative messages (explanatory text accompanying a display of some interesting piece of natural history) with many personal words (like 'you'), or no personal words. For each of several such displays each subject read a personal interpretative message, a nonpersonal interpretative message, and a blank message (no text accompanying the display), and then ordered the three in terms of preference (1 = most preferred, 2 = intermediate, 3 = least preferred). Type of message is a three-level repeated measures variable. Preference ranks were summed across several objects for each subject. The higher the score the lower the preference. Since the data were not normally distributed, we decided to use a nonparametric analysis of variance, the Friedman test. The Friedman test indicated a significant effect of type of interpretative message, H(2, n = 37) = 14.52, p < .001. Wilcoxon's signed-ranks test was used to compare each mean with each other mean (see the means in Table 1). Nonpersonal messages were preferred over personal messages, T(n = 34) = 136.5, z = 2.74, p = .006 and over blank messages, T(n = 36) = 133.5, z = 3.13, p = .002. Personal messages were preferred over blank messages, T(n = 34) = 429, z = 2.26, p = .024. Table 1 Type of Message Median Interquartile Range --------------------------------------------------- Nonpersonal 9 3.5 Personal 11 4.0 Blank 15 7.0 ============================ The SAS Program ================================== $job sas $mdisk 192 karl pswuensc options formdlim='-' ls=78; data bob; infile 'wendling data *'; input id 1-2 (y1-y3) (2.0); proc univariate; var y1-y3; proc glm; model y1-y3 = / nouni; repeated condtn 3 / printe; data bob2; set bob; array ys (X) y1-y3; do over ys; y=ys; output; end; drop y1-y3; proc print; data bob3; set bob2; file 'wendl2 data a'; put id x y; ============================= The Data File ==================================== 00091809 01091610 02170613 03071811 04130617 05081810 06091512 07081711 08061812 09160614 10091512 11101808 12091216 13111510 14091809 15111807 16110916 17071811 18091512 19130617 20180711 21061515 22061515 23081810 24091809 25081414 26131310 27061812 28081810 29111015 30151011 31101808 32081810 33081612 34121014 35121311 36071811