I have a small dataset below for the illustrative purpose,
clear
input str11 race str6 ses meanwrite sdwrite n
"hispanic" "low" 46.11111 9.58442 9
"hispanic" "middle" 46.09091 7.133787 11
"hispanic" "high" 48.25 10.24288 4
"asian" "low" 58 12.12436 3
"asian" "middle" 55.8 7.463243 5
"asian" "high" 61.66667 4.618802 3
"african-amer" "low" 48.09091 8.431542 11
"african-amer" "middle" 48.66667 8.594572 6
"african-amer" "high" 47.66667 16.86219 3
"white" "low" 52.54167 9.084048 24
"white" "middle" 52.80822 9.222041 73
"white" "high" 56.70833 8.7372 48
end
encode race, generate(race2)
encode ses, generate(ses2)
drop ses race
ren race2 race
ren ses2 ses
order race ses meanwrite sdwrite n
g sesrace = race if ses == 1
replace sesrace = race+5 if ses == 2
replace sesrace = race+10 if ses == 3
twoway (bar meanwrite sesrace if race==1) ///
(bar meanwrite sesrace if race==2) ///
(bar meanwrite sesrace if race==3) ///
(bar meanwrite sesrace if race==4) , ///
legend(row(4) position(right) order(1 "Hispanic" 2 "Asian" 3 "Black" 4 "White") ) ///
xlabel(0(5)15) ///
ylabel(0(20)70) ///
xlabel( 3 "Low" 8 "Middle" 13 "High", noticks) ///
xtitle("Socio Economic Status") ytitle("Mean Writing Score")
I know I can borrow some codes from this thread at https://www.statalist.org/forums/for...ificance/page2.
to add brackets to represent the significant difference between "Asian" and "Black" for the Low SES group students.
Can someone give me some help with the code?
Thank you!
clear
input str11 race str6 ses meanwrite sdwrite n
"hispanic" "low" 46.11111 9.58442 9
"hispanic" "middle" 46.09091 7.133787 11
"hispanic" "high" 48.25 10.24288 4
"asian" "low" 58 12.12436 3
"asian" "middle" 55.8 7.463243 5
"asian" "high" 61.66667 4.618802 3
"african-amer" "low" 48.09091 8.431542 11
"african-amer" "middle" 48.66667 8.594572 6
"african-amer" "high" 47.66667 16.86219 3
"white" "low" 52.54167 9.084048 24
"white" "middle" 52.80822 9.222041 73
"white" "high" 56.70833 8.7372 48
end
encode race, generate(race2)
encode ses, generate(ses2)
drop ses race
ren race2 race
ren ses2 ses
order race ses meanwrite sdwrite n
g sesrace = race if ses == 1
replace sesrace = race+5 if ses == 2
replace sesrace = race+10 if ses == 3
twoway (bar meanwrite sesrace if race==1) ///
(bar meanwrite sesrace if race==2) ///
(bar meanwrite sesrace if race==3) ///
(bar meanwrite sesrace if race==4) , ///
legend(row(4) position(right) order(1 "Hispanic" 2 "Asian" 3 "Black" 4 "White") ) ///
xlabel(0(5)15) ///
ylabel(0(20)70) ///
xlabel( 3 "Low" 8 "Middle" 13 "High", noticks) ///
xtitle("Socio Economic Status") ytitle("Mean Writing Score")
I know I can borrow some codes from this thread at https://www.statalist.org/forums/for...ificance/page2.
to add brackets to represent the significant difference between "Asian" and "Black" for the Low SES group students.
Can someone give me some help with the code?
Thank you!
Comment