Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Home
- /
- Analytics
- /
- Stat Procs
- /
- NLMIXED: Alternative covarinace structures?

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 06-30-2011 01:38 PM
(1796 views)

With proc mixed one can specifiy a covariance structure for ranomd effects that has the same structure but with different values for each level of a categorical variable. For example, suppose Time is continuous, Period is a 0/1 variable that signals the transition from one period of time to another, SubjectID identifies the indiviudal subjects. Using proc mixed we can fit a random slope and intercept model where the covarnace struture is different for perods 0 and 1 wiht the following code.

Proc Mixed data=D;

class SubjectID Period;

model y = Time/s;

random intercept time/type=un subject= SubjectID group= period;

run;

Because period changes within subjects, the covariance matrix for the random effects is block diagnonal. Mixed is used as an example but for the model I really want to fit I will need NLMIXED. Can anyone explain how this covariance strucutre can also be implemented with NLMIXED?

Thanks,

Greg

3 REPLIES 3

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

In order to have different random efffect covariance values across levels of some group with the NLMIXED procedure, you need to include group-specific random effects in your linear predictor. When constucting the covariance structure for the random effects, we assume that the group-specific random effects are independent of each other.

For the example which you show above, suppose that period has just two values (1 and 2). Then NLMIXED code which would fit the model specified by your MIXED code would be:

proc nlmixed data=D;

/* construct linear predictor, including random effects */

eta = b0 + b1*time +

(u0_1 + u1_1*time)*(period=1) + /* period 1 random effects */

(u0_2 + u1_2*time)*(period=2); /* period 2 random effects */

/* Parameterize the covariance between u0_i and u1_i as */

/* a function of the correlation between u0_i and u1_i. */

/* Parameterize the correlation between u0_i and u1_i */

/* through the inverse Fisher transformation. */

rho_1 = (exp(2*z1) -1) / (exp(2*z1) + 1); /* rho(u0_1, u1_1) */

rho_2 = (exp(2*z2) -1) / (exp(2*z2) + 1); /* rho(u0_2, u1_2) */

/* Specify and fit the model */

model y ~ normal(eta, Vres);

random u0_1 u1_1 u0_2 u1_2 ~ normal([0,0,0,0],

[Vu0_1, rho_1*sqrt(Vu0_1*Vu1_1), 0, 0,

Vu1_1, 0, 0,

Vu0_2, rho_2*sqrt(Vu0_2*Vu1_2),

Vu1_2])

subject=SubjectID;

run;

Note that this can quickly become a very difficult estimation problem for NLMIXED because of the need to integrate over all random effects.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Hi, Dale:

Shouldn't "time" be part of the random slope terms? That is, I think the linear predictor "eta" should be written as follows:

eta = b0 + b1*time + (u0_1 + u1_1*time)*(period=1) + (u0_2 + u1_2*time)*(period=2);

Ryan

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Yes, indeed! Thanks for the correction.

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. **Registration is now open through August 30th**. Visit the SAS Hackathon homepage.

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.