Solved
Contributor
Posts: 30

# nlmixed - random effect covariate calculation and contrast help

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....?

ming

Accepted Solutions
Solution
‎04-03-2014 08:31 AM
Posts: 2,655

## Re: nlmixed - random effect covariate calculation and contrast help

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

All Replies
Solution
‎04-03-2014 08:31 AM
Posts: 2,655

## Re: nlmixed - random effect covariate calculation and contrast help

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

🔒 This topic is solved and locked.