Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.

# Re: st: How to constraint the sum of the coefficients to zero for a factor variable.

 From Maarten Buis To statalist@hsphsun2.harvard.edu Subject Re: st: How to constraint the sum of the coefficients to zero for a factor variable. Date Fri, 5 Aug 2011 19:33:06 +0200

```--- On Fri, Aug 5, 2011 at 1:28 PM, Sam Brilleman wrote:
>> > Does anyone know how to change the constraint on the coefficients for
>> > 'var4' so that the sum of the coefficients is zero (i.e. sum(b4i) = 0)
>> > rather than treating one of the factor levels as a reference category (i.e.
>> > b4i = 0 for some given i).

--- At 07:19 AM 8/5/2011, Maarten Buis wrote:
>> I don't know of a way to do this in Stata's factor variable notation.
>> You can however create the necesary variables using -xi3-, where they
>> are called "effect coding", see -findit xi3-.

-- -On Fri, Aug 5, 2011 at 5:41 PM, Richard Williams wrote:
> I can't say that I understand it yet, but does the -contrast- command in
> Stata 12 offer a way to deal with this?

I suspect so. I do not have Stata 12 yet, so I cannot check. In
general there is a long tradition of creating different contrasts
(comparisons of groups) by creatively creating variables. The
advantage is that this required relatively little programming, so this
trick could be applied in many programs. Downside is that when you
want to look at a different contrast, you'd have to create new
variables and re-estimate the model. Looking at different contrasts
can greatly improve your understanding of the model, so having to
re-estimate the model is a disadvantage. I suspect that StataCorp
desided to side-step this by providing these different contrasts as a
post-estimation command. I am really looking forward to trying that
out.

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/
```