## Random Syntax in Mixed Models

Occasional Contributor
Posts: 8

# Random Syntax in Mixed Models

Let's say I'm working on a model for human height. There's two groups, one eating a control diet and another eating a supplemented diet. The heights of the individuals are tracked as they age (longitudinal). I use proc mixed with something like

height = age diet;
random personID;

Is this significantly from

height = age diet;
random intercept age diet /sub=personID;

Also can anyone give me insight as to when it would be better to model this as repeated measurements or as random sampling from a population?
Regular Contributor
Posts: 171

## Re: Random Syntax in Mixed Models

I'm not sure what the question is. The model which specifies

random personID;

fits a model with a random intercept term, whereas the model which specifies

random intercept age diet / sub=personID;

fits a model in which each person has their own age slope and their own diet slope. Are you wondering if the model with person-specific age and diet slope effects produces a model which has better fit to the data, then you could use a likelihood ratio test.

Note that this second model would only seem to be valid if each person was observed on multiple diets. If each person receives only a single diet, then there would be no data that would allow you to compute a person-specific diet slope effect. Also, if each person receives only a single diet, then the subject effect should be nested within diet.
Occasional Contributor
Posts: 8

## Re: Random Syntax in Mixed Models

Aahh, not thinking straight,

I meant to ask is

random personID the same as
random intercept sub=personID;

Thanks Dale
Regular Contributor
Posts: 171

## Re: Random Syntax in Mixed Models

Syntax with

random personID;

or

random intercept / sub=personID;

should produce the same log-likelihood and identical random effect variance estimates. I would note that while the results should be identical, the two models are parameterized differently. Because the models are parameterized differently, round-off errors could conceivably produce different results for the alternate syntaxes. If you were to observe any difference in results, such differences should be quite small.

The second form in which you use a subject specification is generally more efficient in use of computer resources. I typically recommend use of the "random intercept / sub=personID;" form.
Occasional Contributor
Posts: 8

## Re: Random Syntax in Mixed Models

Thanks Dale!
Discussion stats
• 4 replies
• 150 views
• 0 likes
• 2 in conversation