Programming the statistical procedures from SAS

repeated measures in glimmix

Accepted Solution Solved
Reply
Occasional Contributor DDK
Occasional Contributor
Posts: 16
Accepted Solution

repeated measures in glimmix

Hello,


I'm trying to figure out how to use glimmix to analyse 'repeated measures within repeated measures' (could not find a way to explain this otherwise in short). For example, assessing animals (receiving a certain treatment) for wounds on several locations on their body (due to aggressive behavior) at several time points (wounds scored as 0 (absent) or 1 (present) and is the response variable):


Animal    treatment      time     body location     score

1                    A                  1                    1                      0            

1                    A                  1                    2                      1

1                    A                  1                    3                      1

1                    A                  1                    4                      0

1                    A                  2                    1                      1  

1                    A                  2                    2                      0

1                    A                  2                    3                      1

1                    A                  2                    4                      0


2                    B                  1                    1                      0  

2                    B                  1                    2                      1

2                    B                  1                    3                      1

2                    B                  1                    4                      0

2                    B                  2                    1                      1  

2                    B                  2                    2                      0

2                    B                  2                    3                      1

2                    B                  2                    4                      0


etc.


So there are four scores per animal per time point. I assume it's a binary distribution with a logit link. I think the time points are indeed repeated measurements, but I'm not sure if I can treat body locations as repeated measurements as well and how to incorporate it in an analysis. Btw, the goal is to assess differences per treatment (odds of having scores in one treatment over the other) and time points. I'd like to use glimmix so that I can also work with random variables (of which there are some present, but that is not my question), instead of working with genmod or catmod.


I'm not really that experienced in statistics, so any help is appreciated.


Accepted Solutions
Solution
‎11-19-2012 07:56 AM
Respected Advisor
Posts: 2,655

Re: repeated measures in glimmix

Since GLIMMIX does not directly support doubly repeated measures (as MIXED does with the Kronecker product type= statement), I think the best you will be able to do is to consider body locations as random subsamples within each animal.  Perhaps something like the following untested code will get you started:

proc glimmix data=yourdata;

class animal treatment time location;

model score=treatment time time*treatment/dist=binary;

random location/subject=animal;

random time/residual subject=animal*location type=ar(1); /* This is the really untested part, as I don't know if you can specify animal*location as a subject since location has previously been categorized as random. */

lsmeans treatment time*treatment/ilink cl;

run;

I hope this helps.

Steve Denham

View solution in original post


All Replies
Solution
‎11-19-2012 07:56 AM
Respected Advisor
Posts: 2,655

Re: repeated measures in glimmix

Since GLIMMIX does not directly support doubly repeated measures (as MIXED does with the Kronecker product type= statement), I think the best you will be able to do is to consider body locations as random subsamples within each animal.  Perhaps something like the following untested code will get you started:

proc glimmix data=yourdata;

class animal treatment time location;

model score=treatment time time*treatment/dist=binary;

random location/subject=animal;

random time/residual subject=animal*location type=ar(1); /* This is the really untested part, as I don't know if you can specify animal*location as a subject since location has previously been categorized as random. */

lsmeans treatment time*treatment/ilink cl;

run;

I hope this helps.

Steve Denham

Occasional Contributor DDK
Occasional Contributor
Posts: 16

Re: repeated measures in glimmix

Thanks Steve, great help!!! It seems to run fine. Initially I was trying the model with:

random location/subject=time;

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

With the idea that location is sort of 'clustered' for every time point and then specifying the time points as repeated. I really wasn't sure about this code, so I'm glad someone with more experience made a suggestion.

Thanks!

A side question. Why is repeated analysis in glimmix for multinomial distributions (different dataset) not possible in glimmix but it is possible in genmod as a GEE analysis?  Just wondering about this as it strikes me odd that genmod is able to do this and glimmix (for mixed models) isn't able to do this. Makes me wonder if I'm specifying something wrong or is that just not developed yet?

Respected Advisor
Posts: 2,655

Re: repeated measures in glimmix

Side question: Well, you can kind of get something like a repeated measures analysis, but the modeling is done on the G matrix.  I expect develoment in this area in future releases.  Here is something I clobbered together from Example 41.11 in the GLIMMIX documentation:

data foot_mv;
   input yr b1 b2 b3 k1 k2 k3;
   if yr=1 then sire = _n_;
    else sire = _n_ - 17;
if sire in (0, 17) then delete;
   datalines;
  1  1  0  0  52 25  0
  1  1  0  0  49 17  1
  1  1  0  0  50 13  1
  1  1  0  0  42  9  0
  1  1  0  0  74 15  0
  1  1  0  0  54  8  0
  1  1  0  0  96 12  0
  1 -1  1  0  57 52  9
  1 -1  1  0  55 27  5
  1 -1  1  0  70 36  4
  1 -1  1  0  70 37  3
  1 -1  1  0  82 21  1
  1 -1  1  0  75 19  0
  1 -1 -1  0  17 12 10
  1 -1 -1  0  13 23  3
  1 -1 -1  0  21 17  3
-1  0  0  1  37 41 23
-1  0  0  1  47 24 12
-1  0  0  1  46 25  9
-1  0  0  1  79 32 11
-1  0  0  1  50 23  5
-1  0  0  1  63 18  8
-1  0  0 -1  30 20  9
-1  0  0 -1  31 33  3
-1  0  0 -1  28 18  4
-1  0  0 -1  42 27  4
-1  0  0 -1  35 22  2
-1  0  0 -1  33 18  3
-1  0  0 -1  35 17  4
-1  0  0 -1  26 13  2
-1  0  0 -1  37 15  2
-1  0  0 -1  36 14  1
-1  0  0 -1  63 20  3
-1  0  0 -1  41  8  1
;
data footshape; set foot_mv;
   array k{3};
   do Shape = 1 to 3;
      count = k{Shape};
      output;
   end;
   drop k:;
run;

proc glimmix data=footshape pconv=1e-6;* method=quad;
   class sire yr;
   nloptions maxiter=100;
   model Shape = b1 b2 b3 / s link=cumprobit dist=multinomial ddfm=kr2;
   *random int / sub=sire s cl;
   random int yr /sub=sire type=ar(1);
   freq count;
run;

Here I treat yr as having an autoregressive error structure across the sires, but only as a G-side random effect.  It works, in the sense that it converges, but it is NOT a true repeated measures analysis.

I think the hold-up is that for a multinomial distribution the pseudo-log likelihood function (required for R-side effects) is not well defined.  It is the same problem that exists (I think) for the Laplace and adaptive quadrature methods.  THIS IS A GUESS, and maybe someone in development can comment.

Steve Denham

Regular Learner
Posts: 1

Re: repeated measures in glimmix

Hello,

 I am stuck with tihs statistic analysis, and I hope you can help me to solve this problem.

I want to analyze the proability of being alive at the end of an experiment (response variable is mort3, a binary data, 0=dead ,1=alive).

I have 30  individuals (geno) from3 diffrent populations (pop), so geno is nested in pop. Since the samples are algae, I split the individuals into different clones (clone) and I exposed half of them to one treatment, and the other half to an other (trm can be future or current conditions). pop, geno are random factors, and trm fixed.

my dataset looks like this:

   pop      geno    clone    trm       mort3 

   pop1       1          1       Future      0 

   pop1       1          2      current      0

    ...           

  pop2       1           1        current    1

 

I run already this glimmix proc:

 

proc glimmix data=WORK.sasdatasetfv method=laplace;

class trm pop geno;

model mort3 (descending) = trm/ distribution=binary;

random pop geno(pop) trm*pop trm*geno(pop) ;

lsmeans trm /cl ilink;

 

covtest'pop' 0 . . . ;

covtest'genpop' . 0 . .;

covtest'trmpop' . . 0 .;

covtest'trmgenopop' . . . 0 ;

covtest'total' zerog;

run;

 

 

From my point of view that isn´t correct because clone should be considered as repeated measure of each single geno, so I tried to use this:

 

proc glimmix data=centr;

class geno pop trm clone;

model mort3= trm / distribution=binary;

random clone/subject=geno;

random trm/ subject=geno*clone;

random geno/ subject=pop;

random trm/ subject=pop*geno;

lsmeans trm/ ilink;

covtest'geno' 0 . . .;

covtest 'genotrm' . 0 . .;

covtest 'pop' . . 0 .;

covtest 'trm*pop' . . . 0;

run;

 

unfortunately, this runs for many hours, so that I have to stop it.

Do you think is correct in this way?

Do you have any suggestion about?

 

thansk in advance

cheers

Luca

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 5026 views
  • 3 likes
  • 3 in conversation