Hello and thanks for taking your time to read an answer my question,
I am working with Stata and I have math grades for two different groups: A and B. I want to see the gap that exists between both groups in each decile. In addition I want to do a box plot of this gap for each decile (I want to have 10 box plots, one for each decile which shows the gap between group grades).
What I first did was to compute the deciles using xtile for both groups:
xtile decileA= mat if group==1, nq(10)
xtile decileB= mat if group==0, nq(10)
However, my observations of group A and B do not have the same number of observations nor distribution. I thought of computing quantiles for each decile and group and subtracting them to get the difference in each decile at each quartile to create the boxplot. However I do not know how to proceed afterwards to create the graph and given that I hace a different number of observations in each group decile I do not know if it is correct to proceed this way.
Now, if I try to use the pctile option and compute the difference at each decile I loose all the variance in the data inside each decile. I only get median differences and not all the quantiles I want.
Ex:
pctile decileA= mat if group==1, nq(10)
pctile decileB= mat if group==0, nq(10)
gen qdiff= decileA- decileB if _n<10
gen qtau=_n/10 if _n<10
graph box qdiff, over(qtau)
I want to know if there is a way to do the graph I am intending to and if there is I would really appreciate your help.
Thanks, Karla
Related Posts with views Creating box plots of the gap between two groups by deciles
How to include several interaction terms within one syntaxHello Guys, I have a model in which variable m moderates 5 different independent variables (x1,x2,x…
Renaming an existing sheet in excel via xl() or putexcelHi im not sure if this is possible or not, but does anyone know if you can rename an existing sheet …
Robustness CheckHi, For my project, I've just been running simple OLS regressions. I was wondering if there was any…
Using subpop reg to compare regression coefficients between groups.I am investigating how access to water and toilets in the household affects educational attainment i…
xtabond2 how to get the best result.Hello, This is my first time running a GMM model. Using below command; xtabond2 trisk l.trisk bind …
Subscribe to:
Post Comments (Atom)
0 Response to views Creating box plots of the gap between two groups by deciles
Post a Comment