turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Stat Procs
- /
- interaction of continuous and categorical variable...

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

04-06-2016 12:35 PM

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:

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

Accepted Solutions

Solution

04-07-2016
05:47 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

04-07-2016 05:47 AM

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];

All Replies

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

04-06-2016 03:46 PM

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

04-06-2016 03:50 PM

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;

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;

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

04-06-2016 04:17 PM

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.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

04-06-2016 04:20 PM

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.

I think the 'continuous' effect has to come first.

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

04-06-2016 04:43 PM

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.

Solution

04-07-2016
05:47 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

04-07-2016 05:47 AM

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];