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

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

From |
Philip Ender <ender97@gmail.com> |

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 11:33:54 -0700 |

Sam Brilleman <sam.brilleman@bristol.ac.uk> wrote: >Dear Statalisters, >I have a GLM regression of the form: >glm outcome var1 var2 i.var3 i.var4, link(log) fam(gamma) eform >where the factor variable 'var4' has 20 levels. >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 assume the -constraint- command does this, but if it is possible I can't seem to work out what the syntax would look like. >Many thanks, >Sam. ------------------------------------------ In Stata 12 the -contrast- comand using a. (adjacent coding), g. (versus grand mean coding), h. (Helmert coding) or p. (orthodonal polynomial coding) prefixes all produce contrast weights that sum to zero. You run the -contrast- command after running the -glm- command. I hope this is useful. Phil -- Phil Ender UCLA Statistical Consulting Group * * 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/

- Prev by Date:
**Re: st: How to constraint the sum of the coefficients to zero for a factor variable.** - Next by Date:
**Re: st: BatPlot options and Creating a Matrix** - Previous by thread:
**Re: st: How to constraint the sum of the coefficients to zero for a factor variable.** - Next by thread:
**st: first differences and growth rates** - Index(es):