BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
FANAZ
Calcite | Level 5

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

1 ACCEPTED SOLUTION

Accepted Solutions
SteveDenham
Jade | Level 19

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

View solution in original post

8 REPLIES 8
SteveDenham
Jade | Level 19

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

Steve Denham

FANAZ
Calcite | Level 5

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

SteveDenham
Jade | Level 19

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

FANAZ
Calcite | Level 5

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.29150.8530-2.96320.3803 2.29  0.1300
  Intercept2             10.35810.8312-1.27101.9871 0.19  0.6666
  Intercept3             16.79071.53663.77919.802319.53  <.0001
  gp      0         1-0.61431.2264-3.01801.7895 0.25  0.6165
  gp      1         00.00000.00000.00000.0000  .     .
  time    0         126.0945   121587.6-238281   238333.4 0.00  0.9998
  time    15        12.10501.4560-0.74864.9587 2.09  0.1482
  time    30        10.46721.2108-1.90592.8404 0.15  0.6996
  time    45        1-0.18381.2766-2.68592.3183 0.02  0.8855
  time    60        1-1.51331.3929-4.24331.2168 1.18  0.2773
  time    120       1-1.51331.3929-4.24331.2168 1.18  0.2773
  time    180       1-0.18381.2766-2.68592.3183 0.02  0.8855
  time    240       1-1.51331.3929-4.24331.2168 1.18  0.2773
  time    300       1-1.51331.3929-4.24331.2168 1.18  0.2773
  time    360       12.10501.4560-0.74864.9587 2.09  0.1482
  time    480       1-0.18381.2766-2.68592.3183 0.02  0.8855
  time    600       1-1.15651.4358-3.97071.6577 0.65  0.4206
  time    720       10.46721.2108-1.90592.8404 0.15  0.6996
  time    1440      00.00000.00000.00000.0000  .     .
  gp*time 0 10.6143   171950.8-337017   337018.0 0.00  1.0000
  gp*time 0 15 1-8.28472.3706   -12.9309-3.638412.21  0.0005
  gp*time 0 30 1-7.33822.3360   -11.9167-2.7598 9.87  0.0017
  gp*time 0 45 1-5.99582.2579   -10.4212-1.5704 7.05  0.0079
  gp*time 0 60 1-3.58332.3657-8.22001.0534 2.29  0.1299
  gp*time 0 1201-1.44682.5517-6.44813.5544 0.32  0.5707
  gp*time 0 1801-2.77632.4974-7.67122.1185 1.24  0.2663
  gp*time 0 2401-1.44682.5517-6.44813.5544 0.32  0.5707
  gp*time 0 3001-1.44682.5517-6.44813.5544 0.32  0.5707
  gp*time 0 3601-5.06522.5993   -10.15960.0293 3.80  0.0513
  gp*time 0 48011.26641.9098-2.47685.0096 0.44  0.5073
  gp*time 0 60011.15651.9261-2.61864.9316 0.36  0.5482
  gp*time 0 7201-1.36631.8842-5.05932.3268 0.53  0.4684
  gp*time 0 144000.00000.00000.00000.0000  .     .
  gp*time 1 00.00000.00000.00000.0000  .     .
  gp*time 1 15 00.00000.00000.00000.0000  .     .
  gp*time 1 30 00.00000.00000.00000.0000  .     .
  gp*time 1 45 00.00000.00000.00000.0000  .     .

Kind regards

SteveDenham
Jade | Level 19

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

1zmm
Quartz | Level 8

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.

SteveDenham
Jade | Level 19

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


FANAZ
Calcite | Level 5

Hi!

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

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 8 replies
  • 2198 views
  • 6 likes
  • 3 in conversation