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

Hi,

I have a similar problem as one of the earlier post(with 3 random variables), , repeated measure of performance over 4-5 trials.  I have a group variable (ordinal - 3 groups).

I'd like to test the differences between the groups (1 vs 2, 1 vs 3, and 2 vs 3).

Here is my attempt to the code,

proc nlmixed data=long;

  parms a1=1 b1=.5 c1=.5 u1=.1 u2=.1 u3=.1 s2e=?? g11=?? g21=?? ...

             a2=0 a3=0 b2=0 b3=0 c2=0 c3=0;

  a=a1+a2*(group=2)+a3*(group=3)+u1;

  b=b1+b2*(group=2)+b3*(group=3)+u2;

  c=c1+c2*(group=2)+c3*(group=3)+u3;

   eqn=a/time**b+c;

   model performance ~ normal(eqn,s2e);

   random u1 u2 u3 ~ normal([0,0,0],[g11,g21,g11,g31,g32,g33]) subject=id;

run;

2 things I am having trouble with are:

1.  how to code "CONTRAST" to test the proper groups.  is it just

contrast "b1 vs b2" b1 - b2;

contrast "b1 vs b3" b1 - b3;

contrast "b2 vs b3" b2 - b3;

contrast "a1 vs a2" a1 - a2;

....

2.  how do I calculate the values to s2e, g11, g21....?

thanks in advance for your help.

ming

1 ACCEPTED SOLUTION

Accepted Solutions
SteveDenham
Jade | Level 19

1.  It looks like these should work, but it may be worthwhile to consider using ESTIMATE statement due to the additional info it gives.

2.  Coming up with initial values, especially for covariances, is hard.  I would try the default values and see where that leads.  Then I would go back and refit with different values, roughly based on the results, and see if I got comparable convergence to the same values.  If you have a lot of time, you could try the grid searching option.

Another method would be to semi-linearize, and use PROC MIXED to get approximate starting values.  Subtract your best common estimate of c from performance, take the logs of both sides, and fit a regression model that accomodates the random effects and the values from the V matrix.

Steve Denham

View solution in original post

1 REPLY 1
SteveDenham
Jade | Level 19

1.  It looks like these should work, but it may be worthwhile to consider using ESTIMATE statement due to the additional info it gives.

2.  Coming up with initial values, especially for covariances, is hard.  I would try the default values and see where that leads.  Then I would go back and refit with different values, roughly based on the results, and see if I got comparable convergence to the same values.  If you have a lot of time, you could try the grid searching option.

Another method would be to semi-linearize, and use PROC MIXED to get approximate starting values.  Subtract your best common estimate of c from performance, take the logs of both sides, and fit a regression model that accomodates the random effects and the values from the V matrix.

Steve Denham

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 1029 views
  • 0 likes
  • 2 in conversation