Unbalanced Variance Analysis with EFFECTPLOT (ICOMEP2)

This code is also available in: Deutsch Español Français
Difficulty Level
Beginner
Published on :
This script illustrates how to analyze a two-factor experimental design (drug and disease) with interactions, on unbalanced data. It uses the GENMOD procedure to fit the model and the EFFECTPLOT statement to generate various plots: effect plots, sliced interactions, boxplots, and mosaic plots.
Data Analysis

Type : CREATION_INTERNE


Data is dynamically generated in the DATA step 'a' via the DATALINES statement. It simulates a clinical study with 'drug', 'disease' variables, and the 'y' response.

1 Code Block
DATA STEP Data
Explanation :
Creation of data table 'a'. The DATA step reads drug and disease identifiers, then loops to read up to 6 'y' measurements per input line.
Copied!
1DATA a;
2 INPUT drug disease @;
3 DO i=1 to 6;
4 INPUT y @;
5 OUTPUT;
6 END;
7 DATALINES;
81 1 42 44 36 13 19 22
91 2 33 . 26 . 33 21
101 3 31 -3 . 25 25 24
112 1 28 . 23 34 42 13
122 2 . 34 33 31 . 36
132 3 3 26 28 32 4 16
143 1 . . 1 29 . 19
153 2 . 11 9 7 1 -6
163 3 21 1 . 9 3 .
174 1 24 . 9 22 -2 15
184 2 27 12 12 -5 16 15
194 3 22 7 25 5 12 .
20;
2 Code Block
PROC GENMOD
Explanation :
ODS graphics activation. Execution of PROC GENMOD to model the response 'y' (default normal distribution). 'effectplot / obs' displays the effect plot with observations. 'effectplot interaction(sliceby=disease)' displays interactions by slicing by the disease variable, with confidence limits (clm).
Copied!
1ods graphics on;
2PROC GENMOD DATA=a;
3 class drug disease;
4 model y=disease drug disease*drug / d=n;
5 effectplot / obs;
6 effectplot interaction(sliceby=disease) / clm;
7RUN;
3 Code Block
PROC GENMOD
Explanation :
Second analysis with complementary visualizations: box plots, cross-interactions with observations, mosaic plots, and interactions faceted by disease (plotby).
Copied!
1PROC GENMOD DATA=a;
2 class drug disease;
3 model y=drug disease drug*disease / d=n;
4 effectplot box;
5 effectplot interaction(x=drug*disease) / obs;
6 effectplot mosaic;
7 effectplot interaction(plotby=disease);
8RUN;
9ods graphics off;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.

Related Documentation

Aucune documentation spécifique pour cette catégorie.