I'm running a Stata code for frailty survival model (multilevel hazard analysis) using 2018 Nigeria Demographic and Health Survey Data.
I wrote the design code using this:
svyset v021, weight(wt2_1) strata(v022), singleunit(centered) || _n, weight(wt1_1)
But when I applied the weight in the code below, it returned an error message that 'option shared() was not allowed with the svy prefix'
svy: stcox i.w_quintile i.v024 v025 poverty_prop, efron shared(v021) || v021:
Please how do I apply weight when running a multilevel hazard analysis using Cox regression (Gamma frailty model)?
Thank you.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float(pid study_time) byte died int v021 byte v022 float(wt2_1 wt1_1) byte(w_quintile v024 v025) float poverty_prop 1 13 0 1 1 401.2 2.507467 5 1 1 0 2 9 0 1 1 401.2 2.507467 5 1 1 0 3 17 0 1 1 401.2 2.507467 5 1 1 0 4 31 0 1 1 401.2 2.507467 5 1 1 0 5 39 0 1 1 401.2 2.507467 5 1 1 0 6 22 0 1 1 401.2 2.507467 5 1 1 0 7 24 0 1 1 401.2 2.507467 5 1 1 0 8 .01 1 1 1 401.2 2.507467 5 1 1 0 9 23 0 1 1 401.2 2.507467 5 1 1 0 10 12 0 1 1 401.2 2.507467 5 1 1 0 11 9 0 1 1 401.2 2.507467 4 1 1 0 12 35 0 1 1 401.2 2.507467 4 1 1 0 13 18 0 1 1 401.2 2.507467 5 1 1 0 14 20 0 1 1 401.2 2.507467 5 1 1 0 15 60 0 1 1 401.2 2.507467 5 1 1 0 16 18 0 2 1 401.2 5.119411 5 1 1 0 17 5 0 2 1 401.2 5.119411 5 1 1 0 18 46 0 2 1 401.2 5.119411 5 1 1 0 19 26 0 2 1 401.2 5.119411 5 1 1 0 20 54 0 2 1 401.2 5.119411 5 1 1 0 21 37 0 2 1 401.2 5.119411 5 1 1 0 22 51 0 2 1 401.2 5.119411 4 1 1 0 23 31 0 2 1 401.2 5.119411 4 1 1 0 24 55 0 2 1 401.2 5.119411 4 1 1 0 25 27 0 2 1 401.2 5.119411 5 1 1 0 26 15 0 2 1 401.2 5.119411 4 1 1 0 27 39 0 2 1 401.2 5.119411 4 1 1 0 28 6 0 2 1 401.2 5.119411 5 1 1 0 29 29 0 2 1 401.2 5.119411 5 1 1 0 30 .01 1 2 1 401.2 5.119411 5 1 1 0 31 9 0 2 1 401.2 5.119411 5 1 1 0 32 40 0 2 1 401.2 5.119411 5 1 1 0 33 23 0 2 1 401.2 5.119411 5 1 1 0 34 12 0 2 1 401.2 5.119411 3 1 1 0 35 35 0 3 1 401.2 2.40911 5 1 1 0 36 56 0 3 1 401.2 2.40911 5 1 1 0 37 14 0 3 1 401.2 2.40911 5 1 1 0 38 40 0 3 1 401.2 2.40911 5 1 1 0 39 57 0 3 1 401.2 2.40911 5 1 1 0 40 42 0 3 1 401.2 2.40911 5 1 1 0 41 5 0 3 1 401.2 2.40911 3 1 1 0 42 42 0 3 1 401.2 2.40911 4 1 1 0 43 39 0 3 1 401.2 2.40911 4 1 1 0 44 39 0 3 1 401.2 2.40911 5 1 1 0 45 54 0 3 1 401.2 2.40911 4 1 1 0 46 19 0 3 1 401.2 2.40911 5 1 1 0 47 52 0 3 1 401.2 2.40911 5 1 1 0 48 42 0 3 1 401.2 2.40911 5 1 1 0 49 7 0 4 1 401.2 1.0620399 5 1 1 .05263158 50 28 0 4 1 401.2 1.0620399 5 1 1 .05263158 51 53 0 4 1 401.2 1.0620399 5 1 1 .05263158 52 5 1 4 1 401.2 1.0620399 5 1 1 .05263158 53 28 0 4 1 401.2 1.0620399 5 1 1 .05263158 54 13 0 4 1 401.2 1.0620399 5 1 1 .05263158 55 37 0 4 1 401.2 1.0620399 5 1 1 .05263158 56 .01 1 4 1 401.2 1.0620399 5 1 1 .05263158 57 23 0 4 1 401.2 1.0620399 5 1 1 .05263158 58 33 0 4 1 401.2 1.0620399 3 1 1 .05263158 59 27 0 4 1 401.2 1.0620399 5 1 1 .05263158 60 36 1 4 1 401.2 1.0620399 5 1 1 .05263158 61 20 0 4 1 401.2 1.0620399 4 1 1 .05263158 62 24 0 4 1 401.2 1.0620399 5 1 1 .05263158 63 58 0 4 1 401.2 1.0620399 5 1 1 .05263158 64 34 0 4 1 401.2 1.0620399 2 1 1 .05263158 65 12 0 4 1 401.2 1.0620399 4 1 1 .05263158 66 44 0 4 1 401.2 1.0620399 4 1 1 .05263158 67 3 0 4 1 401.2 1.0620399 5 1 1 .05263158 68 34 0 5 1 401.2 2.800983 3 1 1 .17391305 69 14 0 5 1 401.2 2.800983 3 1 1 .17391305 70 5 0 5 1 401.2 2.800983 4 1 1 .17391305 71 10 0 5 1 401.2 2.800983 4 1 1 .17391305 72 40 0 5 1 401.2 2.800983 4 1 1 .17391305 73 12 0 5 1 401.2 2.800983 2 1 1 .17391305 74 36 0 5 1 401.2 2.800983 3 1 1 .17391305 75 19 0 5 1 401.2 2.800983 4 1 1 .17391305 76 58 0 5 1 401.2 2.800983 3 1 1 .17391305 77 17 0 5 1 401.2 2.800983 4 1 1 .17391305 78 40 0 5 1 401.2 2.800983 4 1 1 .17391305 79 39 0 5 1 401.2 2.800983 3 1 1 .17391305 80 58 0 5 1 401.2 2.800983 3 1 1 .17391305 81 53 0 5 1 401.2 2.800983 4 1 1 .17391305 82 53 0 5 1 401.2 2.800983 4 1 1 .17391305 83 1 0 5 1 401.2 2.800983 2 1 1 .17391305 84 50 0 5 1 401.2 2.800983 2 1 1 .17391305 85 2 0 5 1 401.2 2.800983 2 1 1 .17391305 86 28 0 5 1 401.2 2.800983 3 1 1 .17391305 87 24 0 5 1 401.2 2.800983 3 1 1 .17391305 88 13 0 5 1 401.2 2.800983 5 1 1 .17391305 89 13 0 5 1 401.2 2.800983 5 1 1 .17391305 90 50 0 5 1 401.2 2.800983 5 1 1 .17391305 91 46 0 6 2 631.8182 1.2421018 3 1 2 .06666667 92 46 0 6 2 631.8182 1.2421018 3 1 2 .06666667 93 19 0 6 2 631.8182 1.2421018 3 1 2 .06666667 94 6 0 6 2 631.8182 1.2421018 3 1 2 .06666667 95 32 0 6 2 631.8182 1.2421018 3 1 2 .06666667 96 59 0 6 2 631.8182 1.2421018 3 1 2 .06666667 97 9 0 6 2 631.8182 1.2421018 4 1 2 .06666667 98 30 0 6 2 631.8182 1.2421018 3 1 2 .06666667 99 30 0 6 2 631.8182 1.2421018 3 1 2 .06666667 100 43 0 6 2 631.8182 1.2421018 2 1 2 .06666667 end label values v022 V022 label def V022 1 "1. nc benue urban", modify label def V022 2 "2. nc benue rural", modify label values w_quintile w_quintile label def w_quintile 2 "2. Second", modify label def w_quintile 3 "3. Middle", modify label def w_quintile 4 "4. Fourth", modify label def w_quintile 5 "5. Highest", modify label values v024 V024 label def V024 1 "1. north central", modify label values v025 V025 label def V025 1 "1. urban", modify label def V025 2 "2. rural", modify
0 Response to Applying weights to multilevel hazard analysis using Cox regression
Post a Comment