- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to run a mixed effect logistic model using proc glimmix with two random intercepts. Some background on the data, doctors and clinics were randomized to receive an intervention, so both doctors, clinics and patients have multiple visits. The goal is to determine whether doctors prescribing decreases over time, rather than patient level effects.
This original model execution by a different analyst in R derived two random intercepts for doctor and clinic, but I can’t find a straightforward way to do this in SAS. I am having trouble distinguishing between ‘random’, ‘repeat’ and ‘subject’ in proc glimmix. I’ve tried a few things, but the only model that worked was:
proc glimmix data=mydata method=quad;
class doctor clinic intervention (ref=‘0’) control (ref=‘0’);
model prescription (event =‘1’)=intervention time control intervention*time control*time intervention*control/solution link=logit dist=binary;
random intercept/subject=doctor(clinic) type=un;
run;
This gives me only one intercept for doctor(clinic), whereas the same model in R provides a random intercept for both doctor and clinic. The coefficients are also different. Both model variables have the exact same counts and structure. Below is the code in R:
Model <- glmer(prescription ~ intervention + time + control + intervention:time + control:time + intervention:control + (1|doctor) + (1|provid), data=mydata, family=binomial(link=logit), nAGQ=1, control=glmerControl(calc.derivs=FALSE))
Is there a way to get the random intercepts for both doctor and clinic in SAS? Is there a reason why the results between SAS and R are inconsistent? I also tried the code below, but received an error that ‘Estimation by quadrature is available only if the data can be processed by subjects’:
proc glimmix data=mydata method=quad;
class doctor clinic intervention (ref=‘0’) control (ref=‘0’);
model prescription (event =‘1’)=intervention time control intervention*time control*time intervention*control/solution link=logit dist=binary;
random intercept/subject=doctor type=un;
random intercept/subject=clinic type=un;
run;
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Try this RANDOM statement (just one statement)
random intercept doctor/subject=clinic type=un;
The only caveat I have here is that there are going to be a lot of covariance parameters to estimate with type=un. You may have to discard the type= option, and just get the variance components for clinic and clinic*doctor (which is the same as doctor within clinic). This will be the only way to keep method=quad. If you are willing to use pseudo-likelihoods you might consider:
random doctor clinic/solution:
SteveDenham
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Try this RANDOM statement (just one statement)
random intercept doctor/subject=clinic type=un;
The only caveat I have here is that there are going to be a lot of covariance parameters to estimate with type=un. You may have to discard the type= option, and just get the variance components for clinic and clinic*doctor (which is the same as doctor within clinic). This will be the only way to keep method=quad. If you are willing to use pseudo-likelihoods you might consider:
random doctor clinic/solution:
SteveDenham
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
The first one worked. Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I post here the same response as to your other posting: we would benefit from knowing more about your study design. Actually, we need to know more about your study design. Channeling Sherlock Holmes:
“Data!data!data!" he cried impatiently. "I can't make bricks without clay.”
― Arthur Conan Doyle, The Adventure of the Copper Beeches
One aspect, in particular: are doctors nested within each clinic (i.e., a given doctor belongs to only one clinic), or are doctors crossed with clinics (i.e., a given doctor practices at multiple clinics)?
The R code specifies doctors crossed with clinics and thus produces a variance among doctors and a variance among clinic (i.e., two "random intercepts"). This is fine IF it is consistent with the design--which we do not yet know. You certainly can do the equivalent in SAS.
Your SAS code specifies doctors as being nesting within clinics.
Two different design concepts, so two different models, so different results. The actual study design determines the statistical model and that should be our guide.
I hope this helps move you forward. But I will note that you are in some rather deep waters, beyond what can be adequately addressed in this forum; is there a statistician at your institution that you can consult with? If so, seek their help.