I want to examine the effects of children' s characteristics on their parent health outcomes. Since parents with multiple children appear multiple times in the dataset, in regression models I want to weight estimates by the number of children to each parent. The idea is to give equal weight to each parent in my regressions. For a father with three children, for example, who therefore appear three times in the data, each observation of that parent is weighted by one third, so that the sum of the weights equal one. The following is what I have tried, but I am not sure if it is correct or not. Any advice is highly appreciated.
Code
Code:
*** Create weight by the number of children bys qid: gen wgt = 1/total_child *** Regression reg psyc csex cmstt cedu [pw=wgt], vce(cluster qid)
Note: did is the id of parents
Code:
clear input long qid float psyc byte(csex cmstt cedu) float total_child 11 0 2 2 7 3 11 0 1 2 5 3 11 0 1 2 7 3 12 0 1 1 5 2 12 0 1 1 7 2 13 4 1 2 7 3 13 4 1 2 7 3 13 4 1 2 7 3 14 4 1 2 4 4 14 4 2 2 6 4 14 4 2 2 6 4 14 4 2 2 5 4 15 0 1 2 4 3 15 0 2 2 5 3 15 0 2 2 5 3 16 0 1 2 5 4 16 0 1 2 5 4 16 0 2 2 5 4 16 0 1 2 7 4 17 1 1 1 5 2 17 1 1 2 5 2 18 0 1 2 7 5 18 0 2 2 6 5 18 0 2 2 7 5 18 0 2 2 5 5 18 0 2 3 6 5 19 0 2 2 4 4 19 0 2 2 6 4 19 0 2 2 4 4 19 0 2 2 7 4 110 4 1 2 7 2 110 4 2 2 7 2 111 0 2 2 7 3 111 0 1 2 7 3 111 0 2 2 7 3 112 0 1 2 6 1 113 2 1 2 4 3 113 2 1 2 5 3 113 2 2 2 5 3 114 7 2 2 4 2 114 7 1 2 4 2 115 3 2 2 6 2 115 3 2 2 6 2 116 3 2 2 8 2 116 3 1 1 6 2 117 1 1 1 7 2 117 1 2 2 7 2 118 4 1 1 7 2 118 4 1 2 6 2 119 6 1 1 5 3 119 6 1 2 6 3 119 6 2 2 7 3 120 0 1 1 5 3 120 0 1 2 6 3 120 0 2 2 7 3 121 1 2 2 4 2 121 1 1 2 4 2 122 3 1 2 4 5 122 3 2 2 7 5 122 3 2 5 4 5 122 3 2 5 4 5 122 3 2 2 4 5 123 3 2 2 7 3 123 3 1 2 7 3 123 3 1 1 7 3 124 6 1 3 3 8 124 6 2 2 3 8 124 6 1 2 3 8 124 6 2 2 3 8 124 6 1 2 5 8 124 6 2 2 4 8 124 6 2 2 4 8 124 6 2 2 3 8 125 2 2 2 7 3 125 2 1 2 7 3 125 2 1 2 7 3 126 7 2 2 3 3 126 7 2 2 1 3 126 7 1 2 3 3 127 6 1 2 2 4 127 6 2 2 4 4 127 6 2 2 4 4 127 6 1 2 2 4 128 2 1 2 3 6 128 2 2 2 2 6 128 2 1 2 2 6 128 2 2 2 3 6 128 2 1 2 2 6 128 2 1 3 2 6 129 0 2 2 6 1 130 5 1 2 4 2 130 5 1 2 4 2 131 4 1 1 7 3 131 4 2 2 7 3 131 4 1 2 4 3 132 2 1 1 5 2 132 2 2 2 5 2 133 0 1 1 5 2 133 0 2 1 7 2 134 0 1 2 7 2 end label values csex LABEL_B119 label def LABEL_B119 1 "Male", modify label def LABEL_B119 2 "Female", modify label values cmstt LABEL_B259 label def LABEL_B259 1 "Single", modify label def LABEL_B259 2 "Married", modify label def LABEL_B259 3 "Divorced", modify label def LABEL_B259 5 "Widow", modify label values cedu LABEL_B269 label def LABEL_B269 1 "No schooling", modify label def LABEL_B269 2 "Incomplete primary school", modify label def LABEL_B269 3 "Primary school", modify label def LABEL_B269 4 "Lower secondary school", modify label def LABEL_B269 5 "Upper secondary school", modify label def LABEL_B269 6 "Prof secondary school", modify label def LABEL_B269 7 "Junior college/university", modify label def LABEL_B269 8 "Master", modify
0 Response to How to run a regression using weight by the number of children to each parent
Post a Comment