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   Richard Williams <>
Subject   Re: st: How to constraint the sum of the coefficients to zero for a factor variable.
Date   Fri, 05 Aug 2011 10:41:21 -0500

At 07:19 AM 8/5/2011, Maarten Buis wrote:
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). Note that the latter is the standard parameter constraint
> used by STATA's estimation commands.

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-.

Hope this helps,

I can't say that I understand it yet, but does the -contrast- command in Stata 12 offer a way to deal with this? The help says

"contrast tests linear hypotheses and forms contrasts involving factor variables and their interactions from the most recently fit model. The tests include ANOVA-style tests of main effects, simple effects, interactions, and nested effects. contrast can use named contrasts to decompose these effects into comparisons against reference categories, comparisons of adjacent levels, comparisons against the grand mean, orthogonal polynomials, and such. Custom contrasts may also be specified."

Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
HOME:   (574)289-5227
EMAIL:  Richard.A.Williams.5@ND.Edu

*   For searches and help try:

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