Ossification Data Analysis with PROC GENMOD

This code is also available in: Deutsch Español Français
Difficulty Level
Beginner
Published on :
The script begins by creating an 'ossification' dataset from embedded data (datalines), representing the results of an experiment on litters with different treatments (PHT, TCPO). A first GEE model is fitted with an independent working correlation matrix. Then, the data is transformed into a binary format (one record per subject) in the 'ossification_b' dataset. A second GEE model is then fitted to this transformed data, this time using an exchangeable working correlation matrix. The results of both analyses are generated in HTML format.
Data Analysis

Type : CREATION_INTERNE


The data is entirely generated within the script via a 'datalines' statement in the first DATA step.

1 Code Block
DATA STEP Data
Explanation :
Creates the 'ossification' dataset by reading data directly from the code via 'datalines'. Each data line represents a litter and the number of successes (t) out of a number of trials (m) for different treatments (tx). Indicator variables (PHT, TCPO) are created to model treatment effects.
Copied!
1DATA ossification;
2 LENGTH tx $8;
3 INPUT tx$ n @;
4 PHT = 1;
5 TCPO = 1;
6 DO i=1 to n;
7 Litters + 1;
8 INPUT t m @;
9 IF tx = 'PHT' THEN PHT = 0;
10 IF tx = 'TCPO' THEN TCPO = 0;
11 IF tx = 'PHT+TCPO' THEN DO;
12 PHT = 0;
13 TCPO = 0;
14 END;
15 OUTPUT;
16 END;
17 drop n i;
18 DATALINES;
19Control 18 8 8 9 9 7 9 0 5 3 3 5 8 9 10 5 8 5 8 1 6 0 5
20 8 8 9 10 5 5 4 7 9 10 6 6 3 5
21Control 17 8 9 7 10 10 10 1 6 6 6 1 9 8 9 6 7 5 5 7 9
22 2 5 5 6 2 8 1 8 0 2 7 8 5 7
23PHT 19 1 9 4 9 3 7 4 7 0 7 0 4 1 8 1 7 2 7 2 8 1 7
24 0 2 3 10 3 7 2 7 0 8 0 8 1 10 1 1
25TCPO 16 0 5 7 10 4 4 8 11 6 10 6 9 3 4 2 8 0 6 0 9
26 3 6 2 9 7 9 1 10 8 8 6 9
27PHT+TCPO 11 2 2 0 7 1 8 7 8 0 10 0 4 0 6 0 7 6 6 1 6 1 7
28;
29RUN;
2 Code Block
PROC GENMOD
Explanation :
Fits a Generalized Estimating Equations (GEE) model to the data. The model uses a binomial distribution with a logit link to model the proportion of successes (t/m) as a function of treatments. A repeated measures analysis is performed on litters, assuming an independent working correlation structure (type=ind).
Copied!
1ods html;
2title "*** Ossification Data -- GEE using GENMOD with Independent Working Correlation Matrix***";
3PROC GENMOD DATA=ossification;
4 class litters tcpo pht / param=ref;
5 model t/m = tcpo pht tcpo*pht / dist=binomial link=logit;
6 repeated subject=litters / type=ind;
7RUN;
8ods html close;
3 Code Block
DATA STEP Data
Explanation :
Transforms the aggregated 'ossification' dataset into a binary format. For each litter, it creates 't' observations with a response variable 'y' equal to 1 (success) and 'm-t' observations with 'y' equal to 0 (failure). This format is required for certain types of binomial analysis.
Copied!
1DATA ossification_b;
2 SET ossification;
3 DO i=1 to t;
4 y = 1;
5 OUTPUT;
6 END;
7 DO i=1 to m-t;
8 y = 0;
9 OUTPUT;
10 END;
11RUN;
4 Code Block
PROC GENMOD
Explanation :
Fits a second GEE model using the binary 'ossification_b' dataset. The model is similar to the first but specifies an exchangeable working correlation structure (type=exch), assuming a constant correlation between all observations within the same litter.
Copied!
1ods html;
2title "*** Ossification Data -- GEE using GENMOD with Exchangeable Working Correlation Matrix***";
3PROC GENMOD DATA=ossification_b descending;
4 class litters tcpo pht / param=ref;
5 model y = tcpo pht tcpo*pht / dist=binomial link=logit;
6 repeated subject=litters / type=exch;
7RUN;
8ods html close;
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.