Type : CREATION_INTERNE
Die Daten werden vollständig innerhalb des ersten DATA STEP generiert. Das Skript simuliert trinomiale Ergebnisse für zwei Produkte unter Verwendung vordefinierter Parameter (Anzahl der Cluster, Clustergröße, zugrunde liegende Wahrscheinlichkeiten, Intra-Cluster-Korrelation) und der Funktion `uniform()` zur Generierung von Zufallszahlen.
| 1 | DATA test_of_homogeneity; |
| 2 | n = 175; *--- Number of Panelists (Clusters) per Test Product; |
| 3 | m = 8; *--- Number of Repeated Measurements per Panelist; |
| 4 | rho2 = 0.15; *--- Intra Cluster Correlation; |
| 5 | pi11 = 0.880; *--- Probability Category 1, Product 1; |
| 6 | pi21 = 0.900; *--- Probability Category 1, Product 2; |
| 7 | pi12 = 0.110; *--- Probability Category 2, Product 1; |
| 8 | pi22 = 0.075; *--- Probability Category 2, Product 2; |
| 9 | seed = 1974; *--- Initial Seed; |
| 10 | rho = sqrt(rho2); |
| 11 | cpi12 = pi11 + pi12; |
| 12 | cpi22 = pi21 + pi22; |
| 13 | DO j = 1 to n; |
| 14 | *--- Product 1; |
| 15 | Product = 1; |
| 16 | Subjid = j; |
| 17 | yy = 3; |
| 18 | u = uniform( seed ); |
| 19 | IF u < cpi12 THEN yy = 2; |
| 20 | IF u < pi11 THEN yy = 1; |
| 21 | DO i=1 to m; |
| 22 | Y = 3; |
| 23 | u = uniform( seed ); |
| 24 | IF u < rho THEN y = yy; |
| 25 | ELSE DO; |
| 26 | uu = uniform( seed ); |
| 27 | IF uu < cpi12 THEN y = 2; |
| 28 | IF uu < pi11 THEN y = 1; |
| 29 | END; |
| 30 | OUTPUT; |
| 31 | END; |
| 32 | *--- Product 2; |
| 33 | Product = 2; |
| 34 | Subjid = j + n; |
| 35 | yy = 3; |
| 36 | u = uniform( seed ); |
| 37 | IF u < cpi22 THEN yy = 2; |
| 38 | IF u < pi21 THEN yy = 1; |
| 39 | DO i=1 to m; |
| 40 | Y = 3; |
| 41 | u = uniform( seed ); |
| 42 | IF u < rho THEN y = yy; |
| 43 | ELSE DO; |
| 44 | uu = uniform( seed ); |
| 45 | IF uu < cpi22 THEN y = 2; |
| 46 | IF uu < pi21 THEN y = 1; |
| 47 | END; |
| 48 | OUTPUT; |
| 49 | END; |
| 50 | END; |
| 51 | keep subjid product y; |
| 52 | RUN; |
| 1 | ods html; |
| 2 | PROC SURVEYLOGISTIC DATA=test_of_homogeneity; |
| 3 | class product subjid / param=glm; |
| 4 | model y (ref=First) = product / link=glogit varadj=morel; |
| 5 | cluster subjid; |
| 6 | lsmeans product / ilink; |
| 7 | estimate 'P12' int 1 product 1 0 / category='1' ilink; |
| 8 | estimate 'P22' int 1 product 0 1 / category='1' ilink; |
| 9 | estimate 'P13' int 1 product 1 0 / category='2' ilink; |
| 10 | estimate 'P23' int 1 product 0 1 / category='2' ilink; |
| 11 | estimate 'P12 Vs P22' product 1 -1 / category='1' exp; |
| 12 | estimate 'P13 Vs P23' product 1 -1 / category='2' exp; |
| 13 | RUN; |
| 14 | ods html close; |
| 1 | ods html; |
| 2 | PROC SURVEYFREQ DATA=test_of_homogeneity; |
| 3 | cluster subjid; |
| 4 | tables product * y / chisq; |
| 5 | RUN; |
| 6 | ods html close; |