Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: k-sample tests for differences in proportions

From   Joseph Coveney <>
To   Statalist <>
Subject   Re: st: k-sample tests for differences in proportions
Date   Wed, 05 Nov 2003 22:37:25 +0900

Karen Robson wrote:


Thanks for your replies. 

What I am trying to calculate is if the mean of a dummy 
variable is different across the categories of a separate 
categorical variable. So if the mean of a dummy variable 
(e.g. let's say 1=has university degree, 0=does not have 
university degree) is significantly different across a 
nominal variable like religious affiliation which has five 
possible values. If I had just two categories in the 
religious affiliation variable, I could just prtest 
university, by(religion). Since I have multiple categories, 
however, this becomes impossible. 

If my DV was continuous, I could do an anova and with 
post-hoc estimations figure out where the significant 
differences between categories were. However, because my DV 
is not continuous, I have been told an anova here is not 
appropriate, hence my confusion. Perhaps I am just being 

I would really appreciate your opinion now that I have 
fully explained myself!


How about -glm-?  See the do-file below for how.  The example is artificial, 
but it shows how to use -glm- followed by -test- to do exactly what you want.  
If you want to adjust for multiple comparisons, Stata can do that, too.  -help 
test-  Also, just as an aside, consider performing logistic regression 
(examining odds ratios, using link(logit)) in lieu of testing differences in 

Joseph Coveney


set obs 300
set seed 20031105
generate byte degreed = uniform() > 0.25
* degreed = 1 for has college degree and 0 for doesn't
generate byte religion = mod(_n, 5) + 1
* religion = 1 for first religion, 2 for second, and so on
* Here we go:

xi: glm degree i.religion, family(binomial) link(identity) nolog
test _Ireligion_2 = _Ireligion_3
test _Ireligion_2 = _Ireligion_4
* . . . and so on


*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index