Dear Stata Enthusiasts
I compute sex ratios for n=1,2,3 parity births and if I identify an abnormal sex ratio at for example 3rd parity birth, I would like to test whether there is significant difference between families with first two children being girls and families with two boys in order to address whether the sex of the child had been manipulated at the third parity birth.
I have a dataset with 46 countries, I would like to test whether in 9 countries, there are difference between the two girls families and two boys families in terms of the third child's gender (for example, do mothers of first two girls give birth to a boy more often than mother of two boys? If yes, there should be significant difference between the sex ratio at third parity birth of mothers with two boys and the sex ratio at third parity birth of mothers with two girls). I would like to automatize the way of computation, so that I do not have to insert the numbers manually (like in: prtesti 37130 .4821 41480 .5234 ). Thank you very much for your help!
I compute sex ratios for n=1,2,3 parity births and if I identify an abnormal sex ratio at for example 3rd parity birth, I would like to test whether there is significant difference between families with first two children being girls and families with two boys in order to address whether the sex of the child had been manipulated at the third parity birth.
I have a dataset with 46 countries, I would like to test whether in 9 countries, there are difference between the two girls families and two boys families in terms of the third child's gender (for example, do mothers of first two girls give birth to a boy more often than mother of two boys? If yes, there should be significant difference between the sex ratio at third parity birth of mothers with two boys and the sex ratio at third parity birth of mothers with two girls). I would like to automatize the way of computation, so that I do not have to insert the numbers manually (like in: prtesti 37130 .4821 41480 .5234 ). Thank you very much for your help!
// Dominican Republic
preserve
keep if country_name == "Dominican Republic"
svyset [pweight = perwt]
svy: tab sex if mom_child_order == 3
svy: tab sex if FirstTwoDaughters[_n-2] == 1 & mom_child_order == 3
svy: tab sex if FirstTwoDaughters[_n-2] == 0 & mom_child_order == 3
prtesti 37130 .4821 41480 .5234
// manipulation
restore
preserve
keep if country_name == "Dominican Republic"
svyset [pweight = perwt]
svy: tab sex if mom_child_order == 3
svy: tab sex if FirstTwoDaughters[_n-2] == 1 & mom_child_order == 3
svy: tab sex if FirstTwoDaughters[_n-2] == 0 & mom_child_order == 3
prtesti 37130 .4821 41480 .5234
// manipulation
restore
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str19 country_name byte(mom_child_order FirstDaughter FirstTwoDaughters sex) double perwt "Bangladesh" 1 1 . 1 20 "Bangladesh" 1 1 . 1 20 "Bangladesh" 1 1 . 1 20 "Bangladesh" 1 0 . 0 20 "Bangladesh" 1 0 . 0 20 "Bangladesh" 2 . . 1 20 "Bangladesh" 1 1 . 1 20 "Bangladesh" 2 . . 1 20 "Bangladesh" 1 1 . 1 20 "Bangladesh" 2 . . 0 20 "Bangladesh" 1 0 . 0 20 "Bangladesh" 2 . . 0 20 "Bangladesh" 1 0 . 0 20 "Bangladesh" 2 . . 0 20 "Bangladesh" 1 1 . 1 20 "Bangladesh" 1 0 0 0 20 "Bangladesh" 2 . . 0 20 "Bangladesh" 3 . . 1 20 "Bangladesh" 1 1 . 1 20 "Bangladesh" 1 1 . 1 20 "Bangladesh" 2 . . 1 20 "Bangladesh" 1 0 . 0 20 "Bangladesh" 1 0 . 0 20 "Bangladesh" 1 0 . 0 20 "Bangladesh" 1 1 . 1 20 "Bangladesh" 2 . . 0 20 "Bangladesh" 1 0 . 0 20 "Bangladesh" 2 . . 0 20 "Bangladesh" 1 0 . 0 20 "Bangladesh" 2 . . 1 20 "Bangladesh" 1 0 . 0 20 "Bangladesh" 2 . . 1 20 "Bangladesh" 3 . . 0 20 "Bangladesh" 1 0 . 0 20 "Bangladesh" 2 . . 1 20 "Bangladesh" 1 1 . 1 20 "Bangladesh" 2 . . 0 20 "Bangladesh" 1 0 . 0 20 "Bangladesh" 1 1 . 1 20 "Bangladesh" 2 . . 0 20 "Bangladesh" 3 . . 0 20 "Bangladesh" 1 0 . 0 20 "Bangladesh" 1 0 0 0 20 "Bangladesh" 2 . . 0 20 "Bangladesh" 3 . . 0 20 "Bangladesh" 1 0 . 0 20 "Bangladesh" 2 . . 1 20 "Bangladesh" 1 0 . 0 20 "Bangladesh" 1 1 . 1 20 "Bangladesh" 1 0 . 0 20 "Bangladesh" 2 . . 0 20 "Bangladesh" 1 1 . 1 20 "Bangladesh" 1 0 . 0 20 "Bangladesh" 2 . . 1 20 "Bangladesh" 1 0 . 0 20 "Bangladesh" 1 1 . 1 20 "Bangladesh" 1 0 . 0 20 "Bangladesh" 2 . . 0 20 "Bangladesh" 1 1 . 1 20 "Bangladesh" 1 1 . 1 20 "Bangladesh" 1 0 . 0 20 "Bangladesh" 1 0 . 0 20 "Bangladesh" 1 0 . 0 20 "Bangladesh" 1 1 . 1 20 "Bangladesh" 1 1 . 1 20 "Bangladesh" 2 . . 1 20 "Bangladesh" 1 1 . 1 20 "Bangladesh" 1 0 . 0 20 "Bangladesh" 1 0 . 0 20 "Bangladesh" 2 . . 1 20 "Bangladesh" 1 0 . 0 20 "Bangladesh" 2 . . 1 20 "Bangladesh" 1 1 . 1 20 "Bangladesh" 1 1 . 1 20 "Bangladesh" 1 1 . 1 20 "Bangladesh" 2 . . 0 20 "Bangladesh" 1 1 1 1 20 "Bangladesh" 2 . . 1 20 "Bangladesh" 3 . . 0 20 "Bangladesh" 1 0 0 0 20 "Bangladesh" 2 . . 0 20 "Bangladesh" 3 . . 0 20 "Bangladesh" 1 1 . 1 20 "Bangladesh" 1 1 . 1 20 "Bangladesh" 2 . . 1 20 "Bangladesh" 1 0 . 0 20 "Bangladesh" 1 0 . 0 20 "Bangladesh" 2 . . 1 20 "Bangladesh" 3 . . 0 20 "Bangladesh" 4 . . 0 20 "Bangladesh" 1 0 . 0 20 "Bangladesh" 2 . . 0 20 "Bangladesh" 1 0 . 0 20 "Bangladesh" 1 0 . 0 20 "Bangladesh" 1 1 . 1 20 "Bangladesh" 2 . . 1 20 "Bangladesh" 1 0 . 0 20 "Bangladesh" 1 1 . 1 20 "Bangladesh" 1 0 . 0 20 "Bangladesh" 2 . . 1 20 end label values sex sex_lbl_new label def sex_lbl_new 0 "Male", modify label def sex_lbl_new 1 "Female", modify
Comment