**Date:** Fri, 30 Dec 2005 14:03:36 -0500
**Reply-To:** jweedon@earthlink.net
**Sender:** "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
**From:** Jay Weedon <jweedon@EARTHLINK.NET>
**Organization:** http://newsguy.com
**Subject:** Re: Using Sub in Random statement of Proc Mixed
**Content-Type:** text/plain; charset=us-ascii
On 30 Dec 2005 09:15:22 -0800, "Hari" <excel_hari@yahoo.com> wrote:

>(After banging my head for past 8 days Im trying this group again)
>
>I posted my above doubts to SAS tech support.
>
>My query was :-
>
>-------------------------------------------------------------------------
>
>Can you tell me as to whether every model which has predictors both in
>Model and random statement can be written in 2 different ways (one
>without subject and second with subject statement and both of the
>methods being syntactically equivalent). For example consider the
>following example which I have picked from SAS/STAT help (Proc Mixed -
>Getting Started - Clustered Data Example)
>
>proc mixed;
> class Family Gender;
> model Height = Gender;
> random Family Family*Gender;
> run;
>
>
>Can you please tell me as to whether the above code has an alternate
>way of writing in which a subject statement is included (and it should
>give same results as the above one)?
>
>
>-------------------------------------------------------------------------
>
>I got the following response from SAS support:-
>
>-------------------------------------------------------------------------
>
>Hari,
>
>Briefly, if there is a common factor to the RANDOM effects you can
>factor out that common factor as SUBJECT=effect. So in the code that
>you provided:
>
>proc mixed;
> class Family Gender;
> model Height = Gender/ddfm=satterth;
> random Family Family*Gender;
> run;
>
>Family is a common factor so you can use the following equivalent
>specification:
>
>proc mixed;
> class Family Gender;
> model Height = Gender/ddfm=satterth;
> random intercept gender/subject=family;
> run;
>
>You may want to consider using DDFM=SATTERTH as it has been my
>experience the DDFM=CONTAINMENT which is the method used by your
>programs can take longer than DDFM=SATTERTH.
>
>-------------------------------------------------------------------------
>
>I couldnt appreciate the logic of "factor out that common factor". 2
>issues with it:-
>
>a) In what sense does factoring work/apply? If I "factor out" family in
>random statement then I should be left with --> Random 1 gender
>/subject = family; >-- while we have random intercept
>gender/subject=family; --> I cant understand as to how number 1 gets
>replaced with intercept (I know having number 1 in random statement is
>weird but cant understand the logic of factor )

1 makes perfect sense, because computationally an intercept is the
regression coefficient attached to a predictor that always has value
1, e.g., in the model

E(Y) = b1*1 + b2*X

you can see that b1 is the expected value of Y when X=0, which is the
definition of the intercept.

MIXED always includes a fixed intercept unless you dictate otherwise,
so the 1 is in the model as a fixed effect whether you know it or not.
Specifying an additional random intercept is the same as also entering
1 as a random effect.

>b) Is the logic of factoring out prevalant across many other procedures
>in SAS , which entails one to write same model using 2 different
>syntaxes? I mean do we have concept of "factoring out" in other procs
>as well (the Proc might not have subject option as such but somewhat on
>similar sense). If yes,please point me to the relevant documentation in
>SAS regarding "factoring out"

The way the MIXED documentation phrases it is:

"...specifying a subject effect is equivalent to nesting all other
effects in the RANDOM statement within the subject effect." In other
words, each family has its own intercept & its own gender effect.

JW