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
- /
- Using repeated measures in Proc glimmix

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

03-07-2015 11:18 AM

Hi,

I have the following question. I've carried out a study in which 96 animals were involved. They were spread over four rounds, so in each round 24 animals were followed up. In each round, animals were spread over 4 treatments, so in each round I had 6 animals per treatment. Treatments in the four rounds were the same.

Each round lasted for two weeks and animals were observed on day 2, 4, 6, 8, 10 and 12.

I want to use proc glimmix to verify differences between the four treatments. However, I have repeated measures for each animals (6 different days) and I'm not sure how to include this.

At first I used the following procedure:

Proc glimmix data=dataset;

class animal treatment day;

model y = treatment day/dist=binary;

random animal;

lsmeans treatment/pdiff;

run;

However, in this way I'm not taking into account the repeated measures per animal. I feel like I need to change the random statement but I'm not sure how.

Do you have any suggestions?

Accepted Solutions

Solution

07-05-2017
07:42 AM

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

04-09-2015 07:50 AM

Sorry to be so late in replying but vacay got in the way.

When you say that time is nested, do you mean that the time points differ from one region_id to another? Also, are the time points equally spaced? Unless both of these hold, autoregressive structures as implemented in MIXED or GLIMMIX aren't appropriate. Until we address that point, you might try the following untested code. It assumes that immigration, GDP, density and trend are all continuous variables:

PROC GLIMMIX DATA=WORK.SAS NOLCPRINT;

CLASS REGION_ID timepoint;

MODEL RACIST_CRIME= IMMIGRATION GDP DENSITY TREND timepoint /SOLUTION DIST=POI LINK=LOG OFFSET=POPUL_LOG DDFM=BW;

RANDOM timepoint/SUB=REGION_ID TYPE =AR(1) RESIDUAL;

RUN;

Now if the timepoints are unequally spaced, and not truly the same across region_id, you may have to address this through the use of a spline.

Steve Denham

All Replies

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

03-09-2015 12:43 PM

You might try:

proc glimmix data=dataset method=laplace;

class animal treatment data;

model y=treatment day treatment*day/dist=binary;

random intercept/subject=animal;

random day/type=ar(1) subject=animal;

lsmeans treatment/diff ilink;

lsmeans treatment*day/slicediff=day ilink;

run;

This will give a conditional estimate of the effects.

The following will be somewhat biased, due to regression to the mean, but is a marginal approach:

proc glimmix data=dataset;

class animal treatment data;

model y=treatment day treatment*day/dist=binary;

random intercept/subject=animal;

random day/residual type=ar(1) subject=animal;

lsmeans treatment/diff ilink;

lsmeans treatment*day/slicediff=day ilink;

I would recommend Walter Stroup's text: *Generalized Linear Mixed Models* if you are going to work in SAS on this analysis.

Steve Denham

run;

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

04-02-2015 11:58 PM

Dear Steve,

I do have a problem with AR(1) while using Glimmix procedure. I have seen that you are very familiar with that command, so I decided to contact you directly. Your help would be more than important and valuable for me at this point. My problem is related to the Glimmix warning: obtaining minimum variance quadratic unbiased estimated as starting values for the covariance parameters failed. I have seen that you have addressed this question in the past with the following command:

random studyday /residual type=&covtype subject= anml_nbr ;*group=grp_no;

%if "&covtype" = "AR(1)" OR "&covtype" = "ARH(1)" %then %do;

random intercept/subject=anml_nbr;

%end;

I have panel data with racially motivated crimes are my dependent variable. The data are structured as pooled cross-national time series, where time is nested . In other words, my dependent and independent variables were collected over time at the regional level. I have detected significant autocorrelation in my dependent variable. There is also an issue of heteroskedasticity.

Here is the command I use:

PROC GLIMMIX DATA=WORK.SAS NOLCPRINT;

CLASS REGION_ID;

MODEL=RACIST_CRIME IMMIGRATION GDP DENSITY TREND /SOLUTION DIST=POI LINK=LOG OFFSET=POPUL_LOG DDFM=BW;

RANDOM INTERCEPT/SUB=REGION_ID TYPE =AR(1) RESIDUAL;

RUN;

I was told to use REPEATED instead of RANDOM, but the former seems to be appropriate only for proc mixed. Here instead I should use RANDOM ... RESIDUAL.

I do not receive the warning when I exclude RESIDUAL, but then I get 0 for the estimate for AR(1) and missing value for its standard error. Thus, I do not think I control for autocorrletation in my data.

When I include RANDOM RESIDUAL, I get the warning: obtaining minimum variance...I

have read that I should use AR(1) plus random effects.

I have read that I should use AR(1) plus random effects. Could you please tell me how to incorporate that? Or perhaps I should use different TYPE. I would be extremely thankful for any help.

Sincerely,

Sylwia

Solution

07-05-2017
07:42 AM

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

04-09-2015 07:50 AM

Sorry to be so late in replying but vacay got in the way.

When you say that time is nested, do you mean that the time points differ from one region_id to another? Also, are the time points equally spaced? Unless both of these hold, autoregressive structures as implemented in MIXED or GLIMMIX aren't appropriate. Until we address that point, you might try the following untested code. It assumes that immigration, GDP, density and trend are all continuous variables:

PROC GLIMMIX DATA=WORK.SAS NOLCPRINT;

CLASS REGION_ID timepoint;

MODEL RACIST_CRIME= IMMIGRATION GDP DENSITY TREND timepoint /SOLUTION DIST=POI LINK=LOG OFFSET=POPUL_LOG DDFM=BW;

RANDOM timepoint/SUB=REGION_ID TYPE =AR(1) RESIDUAL;

RUN;

Now if the timepoints are unequally spaced, and not truly the same across region_id, you may have to address this through the use of a spline.

Steve Denham

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

11-19-2016 02:38 PM

I have been reading quit a bit on the topic but I'm still somewhat confused...

In my case I have an experiment with animals that was replicated 3 years.

Ten animals are used in each year for each of two treatments; at the end of the year they are replaced with new but similar animals.

The variable of interest is the animal's weight. Weights were recorded for animals in two Treatments, at irregularly spaced (Time) intervals (intervals vary between years, but not within years) . My main interest is the weights evolution over time, i.e. the regression of weight on time and treatment, but I also should lke to determine if Year had an effect.

My model then should be (?) Weight= Treatment Time Treatment*Time;

I suspect that the random statement should be something like:

random intercept AnimalNumber Time / subject Year;

I have read that the covariance structure in the random statement above should be specified by type=sp(pow) given the irregular time intervals

covtest 'random slope coeff=0' ...0;

I would certainly appreciate feedback on the above.

Thanks

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

11-30-2016 03:48 PM - edited 11-30-2016 03:56 PM

In the GLIMMIX documentation for SAS/STAT 14.1 there is an example where bodyweights of cows at unequally spaced time points is analyzed. See:

This may help you get started.

Steve Denham

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

11-30-2016 05:10 PM

Thanks Steve. After posting my inquire I found the example, quite useful.

##- Please type your reply above this line. Simple formatting, no

attachments. -##

##- Please type your reply above this line. Simple formatting, no

attachments. -##