BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
jsberger
Obsidian | Level 7

Hi All,

 

I’m working with some longitudinal binomial data in glimmix.   I’ve got 3 time points (0, 1, and 2 as values) and I have some subgroups that are of interest (6, to be exact, two of which are race/ethnicity of White and Black).  I have treated subgroup as a class variable, time as continuous. 

 

I have crafted ESTIMATE statements that provide the estimate for subgroups at each time point (e.g. White at time 0, time 1…Black at time 0, time 1).   I’m also trying to estimate the difference between two points (e.g. say, between time 0 and time 1 for White students.  I’ve been able estimate differences between time, differences between subgroup (White in position 6, Black in position 1)…but I keep getting Non-Est for my interaction of subgroup*time.  I’ve been working from this resource:

https://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewer.htm#statug_glimmix_a00...

 

Below are the estimate statements I have thus far...all but the last one appear to work as I expect.  Can someone kindly tell me what I’m missing (I must be in the weeds on this one)

 

proc glimmix data=cgr_sch method=rspl pconv=.001;

      class school_code time_class subgroup;

      model cgr_num/cgr_den=time subgroup  subgroup*time/link=logit dist=binomial solution ddfm=bw htype=1;

      random intercept time/subject=school_code type=un g gcorr;

      estimate 'white at time 0' intercept 1 time 0 subgroup 0 0 0 0 0 1 subgroup*time [1,0 6],

              'white at time 1' intercept 1 time 1 subgroup 0 0 0 0 0 1 subgroup*time [1,1 6]/cl exp ilink e;

      estimate 'diff 0 vs 1' time [-1,0] [1,1];

      estimate 'diff white v black' subgroup [-1,1] [1,6]/e;

      estimate 'diff 0 vs 1-white' subgroup*time [1,0 6] [-1,1 6]/e;

run;

 

Jason

1 ACCEPTED SOLUTION

Accepted Solutions
jsberger
Obsidian | Level 7

Hi All,

 

Finally got a solution from Susan Durham at Utah State.  Effectively, you have to subtract the code for time 0:

 

estimate intercept 1 subgroup [1, 6] time [1, 0] subgroup*time [1, 0 6];

 

and time 1:

 

estimate intercept 1 subgroup [1, 6] time [1, 1] subgroup*time [1, 1 6];

 

With some cancellation of intercept and subgroup, you get: 

 

estimate 'diff 0 vs 1-white' time [1,1] [-1,0] subgroup*time [1,1 6] [-1,0 6];

View solution in original post

6 REPLIES 6
EastwoodDC
Obsidian | Level 7

Try changing your model statement to this:

model cgr_num/cgr_den= subgroup*time /link=logit dist=binomial solution ddfm=bw htype=1;

Which may get your last Estimate statement to work, but will break the others. 

 

Otherwise you willl need to specify the contrast values for time and subgroup, as well as time*subgroup.

 

 

 

 

 

jsberger
Obsidian | Level 7
Hi, thanks for the reply. I know I can re-parameterize the model and get the estimates directly. But I have other models where quadratics may come in to play. I'm wondering why, based on the hyperlink I included in the post, the way I have it coded won't work.

I have ESTIMATE statements like those that follow that give me the estimates for each time point, but I can't seem to get an estimate of the difference between, say time 0 and time 1 for White students:
estimate 'time 0-white' intercept 1 time 0 subgroup 0 0 0 0 0 1 time*subgroup 0 0 0 0 0 0 /cl exp ilink;
estimate 'time 1-white' intercept 1 time 1 subgroup 0 0 0 0 0 1 time*subgroup 0 0 0 0 0 1 /cl exp ilink;
estimate 'time 2-white' intercept 1 time 2 subgroup 0 0 0 0 0 1 time*subgroup 0 0 0 0 0 2 /cl exp ilink;

EastwoodDC
Obsidian | Level 7

Not sure, but based on the example SAS may have parameterized Time as the last effect. Try this:

estimate 'diff 0 vs 1-white' subgroup*time [1,6 0] [-1,6 0]/e;

 

If you have just a few times, you can make Time a class effect and use LSMeans or LSEstimate / AT Time = 0.

This is sometimes useful with the /e option to show you the correct contract vector, which you can then plug into the Estimate statement.

jsberger
Obsidian | Level 7
I did try that too...SAS kicks an error: "The level 0 is not valid for CLASS variable subgroup."
I think the 'continuous' effect has to come first.
EastwoodDC
Obsidian | Level 7

Some days I hate SAS. 😉

I can't say why it's not working without seeing the parameterization (and maybe not even then), but I suspect the cause is there. I can't always get all the estimates I need from a single paramerterization, sometimes multiple passes at the model are needed.

You might try looking at the different parameterizations you get from:

subgroup*time

subgroup subgroup*time

subgroup|time
to see it that gives you any hints at what is missing.

 

jsberger
Obsidian | Level 7

Hi All,

 

Finally got a solution from Susan Durham at Utah State.  Effectively, you have to subtract the code for time 0:

 

estimate intercept 1 subgroup [1, 6] time [1, 0] subgroup*time [1, 0 6];

 

and time 1:

 

estimate intercept 1 subgroup [1, 6] time [1, 1] subgroup*time [1, 1 6];

 

With some cancellation of intercept and subgroup, you get: 

 

estimate 'diff 0 vs 1-white' time [1,1] [-1,0] subgroup*time [1,1 6] [-1,0 6];

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is ANOVA?

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.

Discussion stats
  • 6 replies
  • 3906 views
  • 2 likes
  • 2 in conversation