# Multilevel models: Meaning of random intercept

I am quite confused at the moment regarding multilevel models as implemented in SAS PROC MIXED. I am new to mixed models.

Let's say I have 2 treatments, a new treatment and a control. And let's say that I have a sample of n subjects, each is contributing 1, 2 or 3 samples, i.e., the treatment (new or control) is being applied in 1 to 3 places in the subject's body.

I can't understand the difference between:

Proc mixed data=...
class Treatment SubjectID;
model Y = Treatment;
Random SubjectID;
run;


and

Proc mixed data=...
class Treatment SubjectID;
model Y = Treatment;
Random intercept / subject = SubjectID;
run;


I can't figure out this intercept / slope issue and its meaning.

-
I think this question should be left here; while it is about SAS code, answering the question requires knowledge of statistics. The SAS part is easy (delete or add a word), the statistics part is not. –  Peter Flom Feb 6 '14 at 12:28
@PeterFlom Happy to accept that, but will someone please edit the post title (and possibly contents) to make that more evident? –  Nick Cox Feb 6 '14 at 13:34
@NickCox I just did so –  Peter Flom Feb 6 '14 at 14:12

Continuing @Peter Flom's example, it is equivalent to write the following two blocks:

proc mixed data=rc;
class Batch;
model Y = ;
random batch;
run;

proc mixed data=rc;
class Batch;
model Y = ;
random int / subject=batch;
run;


This first block adds a random effect term for each level of batch. The second block adds a random intercept and specifies that it varies from 'subject' to 'subject'.

-

In an ordinary regression we model

$Y = XB + \epsilon$

and SAS (as other programs) automatically adds an intercept.

In a multilevel model we model

$Y = XB + Z\gamma + \epsilon$

By default, SAS does not add an intercept to the Z matrix. Adding intercept does that.

To see this, try running the model with and without intercept. E.g., on Example 5 in the MIXED documentation:

data rc;
input Batch Month @@;
Monthc = Month;
do i = 1 to 6;
input Y @@;
output;
end;
datalines;
1   0  101.2 103.3 103.3 102.1 104.4 102.4
1   1   98.8  99.4  99.7  99.5    .     .
1   3   98.4  99.0  97.3  99.8    .     .
1   6  101.5 100.2 101.7 102.7    .     .
1   9   96.3  97.2  97.2  96.3    .     .
1  12   97.3  97.9  96.8  97.7  97.7  96.7
2   0  102.6 102.7 102.4 102.1 102.9 102.6
2   1   99.1  99.0  99.9 100.6    .     .
2   3  105.7 103.3 103.4 104.0    .     .
2   6  101.3 101.5 100.9 101.4    .     .
2   9   94.1  96.5  97.2 95.6     .     .
2  12   93.1  92.8  95.4 92.2   92.2  93.0
3   0  105.1 103.9 106.1 104.1 103.7 104.6
3   1  102.2 102.0 100.8  99.8    .     .
3   3  101.2 101.8 100.8 102.6    .     .
3   6  101.1 102.0 100.1 100.2    .     .
3   9  100.9  99.5 102.2 100.8    .     .
3  12   97.8  98.3  96.9  98.4  96.9  96.5
;

proc mixed data=rc;
class Batch;
model Y = Month / s;
random Int Month / type=un sub=Batch s;
run;


the output includes a solution for the random effect of an intercept.

Running

proc mixed data=rc;
class Batch;
model Y = Month / s;
random batch / type=un sub=Batch s;
run;


does not. This also changes other results.

-