# Re: st: combine indicator values

 From Nikolaos Pandis To statalist@hsphsun2.harvard.edu Subject Re: st: combine indicator values Date Mon, 23 Nov 2009 07:29:32 -0800 (PST)

```Dear Maarten,
This is excatly what I needed.
Many thanks to all the people that responed to my question.
Best wishes,
Nick

--- On Mon, 11/23/09, Maarten buis <maartenbuis@yahoo.co.uk> wrote:

> From: Maarten buis <maartenbuis@yahoo.co.uk>
> Subject: Re: st: combine indicator values
> To: statalist@hsphsun2.harvard.edu
> Date: Monday, November 23, 2009, 1:07 PM
> --- Nikolaos Pandis wrote:
> > If I only enter child2 and child3 (independent
> variables)
> > in the model how would child1 be used as a reference
> for
> > child2 and child3?
>
> Lets consider the simple case of a linear model:
>
> y = b0 + b1 child2 + b2 child3
>
> Now look at what happens at the three possible
> scenarios:
>
> 1 kid means child2 = 0 and child3 = 0:
> y = b0 + b1*0 + b2*0 = b0
>
> 2 kids means child2 = 1 and child3 = 0:
> y = b0 + b1*1 + b2*0 = b0 + b1
>
> 3+ kisd means child2 = 0 and child3 = 1:
> y = b0 + b1*0 + b2*1 = b0 + b2
>
> So, b0 measure the expected value of y when
> there is 1 kid, b1 and b2 measures the
> difference in y relative to the situation
> with only 1 kid.
>
> So leaving child1 out makes it the reference
> category.
>
> In the example below you can see that the
> same logic also works in a logistic regression.
>
> *------------------- begin example ------------------
> sysuse nlsw88, clear
>
> // create a categorical variable from dummy variables
> gen marst = cond(never_married, 1,
>         ///
>             cond(married, 2,
> 3))
> ///
>             if
> !missing(married, never_married)
> label define marst 1 "never married"
>       ///
>
>    2 "married"
>           ///
>
>    3 "divorced/widowed"
>
> //set the reference category to be divorced/widowed
>  char marst[omit] 3
>
> // both -xi- and using the dummy variables lead to
> // exactly the same results
>  xi : logit union i.marst
>  logit union never_married married
> *----------------- end example ---------------------
> ( For more on how to use examples I sent to statalist see:
> http://www.maartenbuis.nl/stata/exampleFAQ.html )
>
> Hope this helps,
> Maarten
>
> --------------------------
> Maarten L. Buis
> Institut fuer Soziologie
> Universitaet Tuebingen
> Wilhelmstrasse 36
> 72074 Tuebingen
> Germany
>
> http://www.maartenbuis.nl
> --------------------------
>
>
>
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```