Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

From   Maarten Buis <[email protected]>
To   [email protected]
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

Hope this helps,

Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
*   For searches and help try:

© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index