Solved
New Contributor
Posts: 4

# scored data in a repeated measure design

Hello everyone!

In a repeated measure design, pain was scored in 5 levels. The number of animals were 4 in each group. and data collected every 15 to 30 min after surgery for 720 min. Can genmod procedure help me?

thnx

Accepted Solutions
Solution
‎06-26-2013 08:43 AM
Posts: 2,655

## Re: scored data in a repeated measure design

Those estimates of zero are based on the parameterization.  There are a variety of ways to parameterize the model: reference, GLM, effect, polynomial, ordinal, and some orthogonal methods.

Try shifting to GLIMMIX (mostly because I am more familiar with it, so I can probably be more helpful).

proc glimmix data=dogpain method=laplace ; /* Laplace integration method */

timec=time; /* Continuous version for spatial power repeated measures */

class gp(ref=first) time(ref=first) dog;

model score=gp|time/solution dist=multinomial or(diff=all); /* Gives odds ratios for main effects */

random time/subject=dog*gp type=sp(pow)(timec);

run;

This will give type3 tests of fixed effects, which for the sample data are significant for gp, and nonsignificant for time and gp*time.

Steve Denham

All Replies
Posts: 2,655

## Re: scored data in a repeated measure design

Yes it can, as can GLIMMIX.  There are good examples in the documentation of both procedures that will help you get started.

Steve Denham

New Contributor
Posts: 4

## Re: scored data in a repeated measure design

Hi Stevdenham!

Would you please to help me to write the GENMOD for this data;

data dogpain;

input gp dog time score;

datalines;

1    1    0    0

1    2    0    0

1    3    0    0

1    4    0    0

1    1    15    2

1    2    15    0

1    3    15    0

1    4    15    0

1    1    30    2

1    2    30    1

1    3    30    1

1    4    30    0

1    1    45    2

1    2    45    2

1    3    45    1

1    4    45    0

1    1    60    2

1    2    60    2

1    3    60    1

1    4    60    2

1    1    120    2

1    2    120    2

1    3    120    1

1    4    120    2

1    1    180    2

1    2    180    0

1    3    180    1

1    4    180    2

1    1    240    2

1    2    240    2

1    3    240    1

1    4    240    2

1    1    300    2

1    2    300    2

1    3    300    1

1    4    300    2

1    1    360    2

1    2    360    0

1    3    360    0

1    4    360    0

1    1    480    2

1    2    480    0

1    3    480    1

1    4    480    2

1    1    600    2

1    2    600    2

1    3    600    2

1    4    600    0

1    1    720    0

1    2    720    2

1    3    720    1

1    4    720    1

0    1    0    0

0    2    0    0

0    3    0    0

0    4    0    0

0    1    15    2

0    2    15    3

0    3    15    2

0    4    15    3

0    1    30    1

0    2    30    3

0    3    30    3

0    4    30    3

0    1    45    2

0    2    45    3

0    3    45    2

0    4    45    3

0    1    60    2

0    2    60    2

0    3    60    2

0    4    60    3

0    1    120    2

0    2    120    2

0    3    120    2

0    4    120    2

0    1    180    2

0    2    180    2

0    3    180    2

0    4    180    2

0    1    240    2

0    2    240    2

0    3    240    2

0    4    240    2

0    1    300    2

0    2    300    2

0    3    300    2

0    4    300    2

0    1    360    2

0    2    360    2

0    3    360    2

0    4    360    2

0    1    480    2

0    2    480    0

0    3    480    2

0    4    480    0

0    1    600    1

0    2    600    2

0    3    600    2

0    4    600    1

0    1    720    1

0    2    720    2

0    3    720    2

0    4    720    2

;

Thank you.

Farnaz

Posts: 2,655

## Re: scored data in a repeated measure design

Look at Example 40.5 GEE for Binary Data with Logit Link Function to get the skeleton of code.  Then try (and I emphasize try) to change the distribution to MULTINOMIAL.  Provide the code you come up with, and I should be able to help more.

Steve Denham

New Contributor
Posts: 4

## Re: scored data in a repeated measure design

Dear SteveDenham,

I run the data according to example # 40.5. In any run I found the value of zero was estimated for gp=1. The error in Log file and some part of the results are below:

1095  ;

1096  proc genmod;

1097        class gp time dog;

1098        model comfort=gp|time  / dist=multinomial type1;

1099        repeated  subject=dog (GP)/ corr=ind corrw;

1100     run;

WARNING: TYPE1 tests are not available with the REPEATED statement.

NOTE: PROC GENMOD is modeling the probabilities of levels of comfort having LOWER Ordered Values in

the response profile table. One way to change this to model the probabilities of HIGHER

Ordered Values is to specify the DESCENDING option in the PROC statement.

NOTE: Algorithm converged.

NOTE: The scale parameter was held fixed.

NOTE: The working correlation table is not created for this model.

WARNING: The generalized Hessian matrix is not positive definite. Iteration will be terminated.

ERROR: Error in parameter estimate covariance computation.

ERROR: Error in estimation routine.

NOTE: The SAS System stopped processing this step because of errors.

NOTE: PROCEDURE GENMOD used (Total process time):

real time           1.07 seconds

 Standard   Wald 95% Confidence Chi- Parameter DF   Estimate Error Limits Square   Pr > ChiSq

 Intercept1 1 -1.2915 0.8530 -2.9632 0.3803 2.29 0.1300 Intercept2 1 0.3581 0.8312 -1.2710 1.9871 0.19 0.6666 Intercept3 1 6.7907 1.5366 3.7791 9.8023 19.53 <.0001 gp 0 1 -0.6143 1.2264 -3.0180 1.7895 0.25 0.6165 gp 1 0 0.0000 0.0000 0.0000 0 . . time 0 1 26.0945   121587.6 -238281   238333.4 0.00 0.9998 time 15 1 2.1050 1.4560 -0.7486 4.9587 2.09 0.1482 time 30 1 0.4672 1.2108 -1.9059 2.8404 0.15 0.6996 time 45 1 -0.1838 1.2766 -2.6859 2.3183 0.02 0.8855 time 60 1 -1.5133 1.3929 -4.2433 1.2168 1.18 0.2773 time 120 1 -1.5133 1.3929 -4.2433 1.2168 1.18 0.2773 time 180 1 -0.1838 1.2766 -2.6859 2.3183 0.02 0.8855 time 240 1 -1.5133 1.3929 -4.2433 1.2168 1.18 0.2773 time 300 1 -1.5133 1.3929 -4.2433 1.2168 1.18 0.2773 time 360 1 2.1050 1.4560 -0.7486 4.9587 2.09 0.1482 time 480 1 -0.1838 1.2766 -2.6859 2.3183 0.02 0.8855 time 600 1 -1.1565 1.4358 -3.9707 1.6577 0.65 0.4206 time 720 1 0.4672 1.2108 -1.9059 2.8404 0.15 0.6996 time 1440 0 0.0000 0.0000 0.0000 0 . . gp*time 0 0 1 0.6143   171950.8 -337017   337018.0 0 1.0000 gp*time 0 15 1 -8.2847 2.3706   -12.9309 -3.6384 12.21 0.0005 gp*time 0 30 1 -7.3382 2.3360   -11.9167 -2.7598 9.87 0.0017 gp*time 0 45 1 -5.9958 2.2579   -10.4212 -1.5704 7.05 0.0079 gp*time 0 60 1 -3.5833 2.3657 -8.22 1.0534 2.29 0.1299 gp*time 0 120 1 -1.4468 2.5517 -6.4481 3.5544 0.32 0.5707 gp*time 0 180 1 -2.7763 2.4974 -7.6712 2.1185 1.24 0.2663 gp*time 0 240 1 -1.4468 2.5517 -6.4481 3.5544 0.32 0.5707 gp*time 0 300 1 -1.4468 2.5517 -6.4481 3.5544 0.32 0.5707 gp*time 0 360 1 -5.0652 2.5993   -10.1596 0.0293 3.80 0.0513 gp*time 0 480 1 1.2664 1.9098 -2.4768 5.0096 0.44 0.5073 gp*time 0 600 1 1.1565 1.9261 -2.6186 4.9316 0.36 0.5482 gp*time 0 720 1 -1.3663 1.8842 -5.0593 2.3268 0.53 0.4684 gp*time 0 1440 0 0.0000 0.0000 0 0.0000 . . gp*time 1 0 0 0.0000 0.0000 0 0.0000 . . gp*time 1 15 0 0.0000 0.0000 0 0.0000 . . gp*time 1 30 0 0.0000 0.0000 0 0.0000 . . gp*time 1 45 0 0.0000 0.0000 0 0.0000 . .

Kind regards

Solution
‎06-26-2013 08:43 AM
Posts: 2,655

## Re: scored data in a repeated measure design

Those estimates of zero are based on the parameterization.  There are a variety of ways to parameterize the model: reference, GLM, effect, polynomial, ordinal, and some orthogonal methods.

Try shifting to GLIMMIX (mostly because I am more familiar with it, so I can probably be more helpful).

proc glimmix data=dogpain method=laplace ; /* Laplace integration method */

timec=time; /* Continuous version for spatial power repeated measures */

class gp(ref=first) time(ref=first) dog;

model score=gp|time/solution dist=multinomial or(diff=all); /* Gives odds ratios for main effects */

random time/subject=dog*gp type=sp(pow)(timec);

run;

This will give type3 tests of fixed effects, which for the sample data are significant for gp, and nonsignificant for time and gp*time.

Steve Denham

Regular Contributor
Posts: 152

## Re: scored data in a repeated measure design

Sort the dogs within each GP and the time within each dog:   proc sort;   by gp dog time;   run; Specify formats for the GP reference and the time reference to obtain interpretable results:  proc format;     value timefm 0="{ 0=Baseline";     value gpfm 0=" 0=Reference";  run; Specify the PROC GENMOD model so that the dependent variable is modelled with the lowest value of the dependent variable as the reference level and the reference levels of the GP and the TIME are specified (I assume that the dependent variable, COMFORT, is the same as the variable, SCORE, in your sample data set):  proc genmod descending;       class gp dog time;       model comfort=gp | time / dist=multinomial;       repeated subject=dog(gp) / corr=ind;       format gp gpfm. time timefm.; run; quit; More appropriate working correlation models for the repeated measures of time within the dogs than the independence model might be an exchangeable (compound symmetry) model or an unstructured model.  The REPEATED statement option, CORRW, doesn't print out because the independence working correlation model is an identity matrix. The model specified above converges with your data set without any errors.

Posts: 2,655

## Re: scored data in a repeated measure design

GENMOD only allows the independence structure for multinomial models.  This would be a good reason, at least in my opinion, to shift to GLIMMIX.

What is going to be most difficult here would be getting the odds ratios for group 0 vs group 1 at each time point independently, if the interaction had come up as significant.  The best I can come up with would be to rerun the model, reparameterizing the entire model as a one-way analysis to get all of the possible odds ratios, and discarding those that are not of interest.  If anyone can come up with a more elegant way (equivalent to a SLICE option under LSMEANS), I want to know, so that we can start using this method for repeated scores.

Steve Denham

New Contributor
Posts: 4

## Re: scored data in a repeated measure design

Hi!

The error remained in my try. I have to thank you for your time.

🔒 This topic is solved and locked.