2

I'm doing a Poisson regression in Stata, so the dependent variable is a count variable and I have some categorical predictors. If A is a categorical variable with, for example, 4 levels, in the parameter estimates table I get results for the 3 levels of the variable compared to the level I have set as the reference category. Similarly for an interaction term. However, I would also like to have an estimate of the overall effect of variable A and also an estimate of the overall effect of the interaction. How do I do this in Stata?

Ie. I need the test of the effect of A in the model on the dependent variable D, which tests the joint hypothesis that every one of the four levels of A has the same effect on D, and therefore A does not explain any of the variation in D, and so it is not a significant predictor of D in the model. I do not need a test which tests the hypothesis that the effects on D of e.g. A2 , A3, or A4, respectively, are all equal to each other in this model, but not necessarily equal to the effect of A1.

Thank you

UPDATE: Well, prompted by the comments from all of you, and after hours of trying out different things, I found that what I was looking for was "constrast A", described in http://www.stata.com/manuals13/u25.pdf However, I am now wondering why "contrast A" does not give me the same results as "test A4=A3=A2=A1". I'm told I shouldn't make stata-specific questions, however I'm trying to see how stata corresponds to other packages and this is what prompted my question. I also think that if someone can answer this question for me i.e. why constrast is not the same as a joint test on whether all levels have the same effect, then this would be of general interest as it obviously translates to a general statistical question.

anna
  • 69
  • 6
  • Maybe [margin](http://www.ats.ucla.edu/stat/stata/dae/poissonreg.htm) can help? Also you may want to rephrase it into a statistical question because software instruction is considered off-topic. – Penguin_Knight Oct 25 '13 at 13:56
  • @Penguin_Knight: thank you, however when I do margins I get predictives for each level of the categorical variable, even without using the i prefix. I want one estimate, of the overall effect, i.e. something like a trend, which you usually get if you treat the categorical as continuous. – anna Oct 25 '13 at 14:10
  • The "overall effect" (i.e., the 2 df test of a three-level categorical variable) is different from the test of the linear effect of a variable. Which one do you want? – Patrick S. Forscher Oct 25 '13 at 14:19
  • I'm sorry but the use of "overall" has caused some confusion, as I use overall to denote the significance of the categorical predictor in the model, i.e. whether it has any effect/contribution/significance to the model. The n-df test of a n+1-level categorical variable is what I call an equality test on whether the effects of some levels are equal to each other. Therefore, have edited my question. – anna Oct 25 '13 at 16:51
  • Maarten Buis' answer seems to perfectly solve the problem: if the true effects of A4, A3 and A2 *compared to A1* are all zero, then obviously the true effects of all four levels are the same. – Michael M Oct 25 '13 at 20:24

1 Answers1

3

Given your comments I will assume that you do not want an estimate of the size of the effect but instead a statistical test whether the expected (possibly adjusted) count for each of the categories are the same. This may or may not be wise depending on your circumstances, but this is an example of how you do it in Stata:

webuse dollhill3
poisson deaths smokes i.agecat, exposure(pyears)
testparm i.agecat

If you want something like a single effect size you could look into sheaf coefficients. In case of interaction terms this generalizes to a model with parametrically weighted covariates. A brief discussion on how to do those in Stata can be found here.

Maarten Buis
  • 19,189
  • 29
  • 59