Solved
New Contributor
Posts: 2

Repeated measures for proportions scores

Hello,

I’m trying to figure out the best procedure to analyze ‘repeated measures for proportions scores’. In this case I counted the number of grazed or ungrazed components (grass) of two pastures (treatments) samples or patches throughout the day, when the area was grazed by cows. The objective is to see any difference in the grazing pattern in these two kind of swards. I did these measures in 10 patches (subject), four times a day, for two consecutive days and three seasons of the year (spring, summer and autumn). My data set looks like this:

 Season Day Treatment Patch HOUR GRAZED UNGRAZED GrazedProp Spring 1 1 1 1 6 15 0.285714 Spring 1 1 1 4 19 0 1 Spring 1 1 1 11 17 0 1 Spring 1 1 1 23 21 2 0.913043 Spring 1 1 2 1 15 61 0.197368 Spring 1 1 2 4 25 1 0.961538 Spring 1 1 2 11 61 0 1 Spring 1 1 2 23 36 0 1 Spring 1 1 3 1 13 43 0.232143 Spring 1 1 3 4 17 1 0.944444 Spring 1 1 3 11 23 0 1 Spring 1 1 3 23 13 0 1 Spring 1 1 4 1 16 33 0.326531 Spring 1 1 4 4 15 33 0.3125 Spring 1 1 4 11 62 0 1 Spring 1 1 4 23 60 0 1 Spring 1 2 1 1 14 81 0.147368 Spring 1 2 2 1 21 62 0.253012 Spring 1 2 3 1 6 53 0.101695 Spring 1 2 4 1 14 34 0.291667

Etc…

I was thinking to analyze the data set with the MIXED procedure, but the data set is not normal, as at the beginning of the day a most of the grasses are ‘ungrazed’ and, as the day goes on, the cows graze most of the grasses so I will have almost all of the grasses grazed by hour 11 or 23.

proc mixed data=Grazedungrazed;

class  season day HOUR Treatment Patch;

model

GrazedProp      =  season|Treatment|hour

/DDFM = satterth;

repeated day(HOUR) / Subject = Treatment*date*patch Type=ar(1);

random patch;

LSmeans season|Treatment|hour / pdiff = all adjust = tukey;

ods output   LSmeans = Grazmeans Diffs = GrazPdiffs;

title ' Grazedprop';

run;

However, a friend of mine suggested that GLIMMIX will be a better procedure for this kind of analysis and I am a little bit doubtful now…  especially because I'm not really that experienced in statistics, so any help is appreciated.

Thanks

Accepted Solutions
Solution
‎04-02-2013 01:42 PM
Posts: 2,655

Re: Repeated measures for proportions scores

It's just a short trip over to GLIMMIX from MIXED, and you can accommodate the distribution as well.  I would try to get this into the successes/trials syntax, so first I would process the dataset to create the variable GRASSES = GRAZED + UNGRAZED.

Now when the repeated structure is addressed we run into a problem:  I don't see date on the dataset as a variable, and ar(1) is not appropriate for modeling unevenly spaced in time data.  I am going to assume that day and date are synonymous.  Also, since hours is nested within day, it would be easier to model as a singly repeated series by creating the variable ELAPSED = 24*day + HOUR.  Because of the uneven spacing, I would also have the continuous version available.  GLIMMIX allows programmatic statements so I would create them there.

Then, I would fit the following conditional model:

proc glimmix data=Grazedungrazed;

class  season ELAPSED Treatment Patch;

ELAPSED = 24*day + hour;

elapsedt=ELAPSED;

model  Grazed/Grasses      =  season|Treatment|ELAPSED/ddfm=satterth dist=binomial;

random intercept/subject=patch;

random ELAPSED / Subject = Treatment*patch Type=sp(pow)(elapsedt);

/* I do not have this as a traditional R side repeated/_residual_, following Stroup (2013) and fitting a conditional model, so that the estimates are the proportions conditional on the random effects, rather than averaged over the time points (marginals) */

;

ods output   LSmeans = Grazmeans Diffs = GrazPdiffs;

title ' Grazedprop';

run;

I hope this gets you pointed in the direction you want to go.

Steve Denham

All Replies
Solution
‎04-02-2013 01:42 PM
Posts: 2,655

Re: Repeated measures for proportions scores

It's just a short trip over to GLIMMIX from MIXED, and you can accommodate the distribution as well.  I would try to get this into the successes/trials syntax, so first I would process the dataset to create the variable GRASSES = GRAZED + UNGRAZED.

Now when the repeated structure is addressed we run into a problem:  I don't see date on the dataset as a variable, and ar(1) is not appropriate for modeling unevenly spaced in time data.  I am going to assume that day and date are synonymous.  Also, since hours is nested within day, it would be easier to model as a singly repeated series by creating the variable ELAPSED = 24*day + HOUR.  Because of the uneven spacing, I would also have the continuous version available.  GLIMMIX allows programmatic statements so I would create them there.

Then, I would fit the following conditional model:

proc glimmix data=Grazedungrazed;

class  season ELAPSED Treatment Patch;

ELAPSED = 24*day + hour;

elapsedt=ELAPSED;

model  Grazed/Grasses      =  season|Treatment|ELAPSED/ddfm=satterth dist=binomial;

random intercept/subject=patch;

random ELAPSED / Subject = Treatment*patch Type=sp(pow)(elapsedt);

/* I do not have this as a traditional R side repeated/_residual_, following Stroup (2013) and fitting a conditional model, so that the estimates are the proportions conditional on the random effects, rather than averaged over the time points (marginals) */

;

ods output   LSmeans = Grazmeans Diffs = GrazPdiffs;

title ' Grazedprop';

run;

I hope this gets you pointed in the direction you want to go.

Steve Denham

New Contributor
Posts: 2

Re: Repeated measures for proportions scores

Hi Steve,

Sorry about the day/date issue and you are right, they are synonymous. The model you suggest seem very interesting.  Considering elapsing day and hour might be easier however I should mentioned that despite that the collection days are consecutives, they are repetitions and for this reason they can not be considered as a single timeline that is why I was using hours nested within day as a repeated measure. Is there any way to use nested repeated measures with GLIMIX using the sp(pow) covariance structure?

Thanks again for your time and help

Daniel

Posts: 2,655

Re: Repeated measures for proportions scores

If days are consecutive, but hours are not, you might be able to use this (UNTESTED):

proc glimmix data=Grazedungrazed;

class  season day hour Treatment Patch;

elapsedt=hour;

model  Grazed/Grasses      =  season|Treatment|ELAPSED/ddfm=satterth dist=binomial;

random intercept/subject=patch;

random day / Subject = Treatment*patch Type=ar(1);

random hour / Subject = Treatment*patch*day Type=sp(pow)(elapsedt);

/* I do not have this as a traditional R side repeated/_residual_, following Stroup (2013) and fitting a conditional model, so that the estimates are the proportions conditional on the random effects, rather than averaged over the time points (marginals) */

;

ods output   LSmeans = Grazmeans Diffs = GrazPdiffs;

title ' Grazedprop';

run;

You may run up against memory and computing time problems with this, unfortunately.

Steve Denham

🔒 This topic is solved and locked.