I tried to analyze the data from SAS paper 261-27 (Kuss Oliver) with the events/trial syntax both with proc genmod and with proc glimmix and found different results? Should the single trial syntax be used?
This is the full code:
data infection_grouped ;
input clinic treatment x n ;
datalines ;
1 1 11 36
1 0 10 37
2 1 16 20
2 0 22 32
3 1 14 19
3 0 7 19
4 1 2 16
4 0 1 17
5 1 6 17
5 0 0 12
6 1 1 11
6 0 0 10
7 1 1 5
7 0 1 9
8 1 4 6
8 0 6 7
run;
data infection_bin (drop=i);
set infection_grouped ;
do i=1 to n;
if i<=x then cure=1;
if i>x then cure=0;
status = 2-cure;
output;
end;
run;
* with proc genmod the data must be ungrouped;
proc genmod data=infection_bin descending order=data;
class treatment clinic;
model cure = treatment / d=bin link=logit;
repeated subject=clinic / type=cs ;
estimate "treatment" treatment 1 -1 /exp ;
run;
* correlated data cannot be analysed with the events/trial syntax in proc genmod;
* the following is wrong;
proc genmod data=infection_grouped descending order=data;
class treatment clinic;
model x/n = treatment / d=bin link=logit;
repeated subject=clinic / type=cs ;
estimate "treatment" treatment 1 -1 /exp ;
run;
* with proc glimmix;
proc glimmix data=infection_grouped;
class treatment clinic;
model x/n = treatment / solution;
random _residual_ / subject=clinic type=cs;
estimate "treatment" treatment 1 -1 /exp ;
run;
proc glimmix data=infection_bin;
class treatment clinic;
model cure = treatment / solution;
random _residual_ / subject=clinic type=cs;
estimate "treatment" treatment 1 -1 /exp ;
run;
proc glimmix data=infection_grouped;
class treatment clinic;
model x/n = treatment / solution;
random intercept / subject=clinic ;
estimate "treatment" treatment 1 -1 /exp ;
run;
proc glimmix data=infection_bin;
class treatment clinic;
model cure = treatment / solution;
random intercept / subject=clinic ;
estimate "treatment" treatment 1 -1 /exp ;
run;
Is it possible to clarify this?
Veronique
Keep in mind that all observations with the same value of the SUBJECT= variable in GENMOD's REPEATED statement are considered correlated, and any two observations with different values are considered uncorrelated. Further, the event/trials syntax allows you to specify a set of independent trials. So, the two analyses are making very different assumptions about the data. With events/trials syntax, the 36 trials in the clinic 1, trt 1 set are treated as independent as are the 37 trials in the clinic 1, trt 2 set, but any two trials in differing sets are treated as correlated. However, in the analysis without events trials syntax, all 36+37 trials in clinic 1 are treated as correlated.
Also, because the working correlation in the events/trials analysis is extremely high, GENMOD is unable to converge. If you use type=fixed(1,.99,.99,1) instead of type=cs to limit the correlation, it can converge.
Keep in mind that all observations with the same value of the SUBJECT= variable in GENMOD's REPEATED statement are considered correlated, and any two observations with different values are considered uncorrelated. Further, the event/trials syntax allows you to specify a set of independent trials. So, the two analyses are making very different assumptions about the data. With events/trials syntax, the 36 trials in the clinic 1, trt 1 set are treated as independent as are the 37 trials in the clinic 1, trt 2 set, but any two trials in differing sets are treated as correlated. However, in the analysis without events trials syntax, all 36+37 trials in clinic 1 are treated as correlated.
Also, because the working correlation in the events/trials analysis is extremely high, GENMOD is unable to converge. If you use type=fixed(1,.99,.99,1) instead of type=cs to limit the correlation, it can converge.
Thank you Dave,
I understand now. I repeated the analysis with the multicenter data from https://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_glimmix_a00...
both with proc glimmix and proc genmod. Accidentally, the previous example did not turn out well because of the convergence problem with proc genmod, which problem I do not have with the multicenter data
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.