I want to make compare two proportions of a categorical variable by two different explanatory variables. My categorical variable is edu (1=literate; 0=no edu) and my two explanatory variables are sex and region. How can I make test statistics to see if there is significant difference in the share of literate people for males Vs for those who live in two regions as shows in the example below?
Code:
clear input sex region edu weight 1 2 0 230 1 3 1 200 0 3 0 240 1 1 1 250 1 2 1 300 0 3 0 280 0 1 0 180 1 1 1 340 1 2 0 270 0 1 1 210 end lab def sex 0 "female" 1 "male" lab val sex sex lab def region 1 "sari" 2 "mexi" 3 "bata" lab val region region lab def edu 0 "no edu" 1 "literate" lab val edu edu sum edu if (region==1 | region==3) sum edu if sex ==1 . sum edu if (region==1 region==3) Variable Obs Mean Std. Dev. Min Max edu 7 .5714286 .5345225 0 1 . sum edu if sex ==1 Variable Obs Mean Std. Dev. Min Max edu 6 .6666667 .5163978 0 1
0 Response to Comparing proportions by two different variables
Post a Comment