Home » Countries » Ethiopia » malawi (logistic regression )
malawi [message #17523] |
Fri, 05 April 2019 15:32 |
mmbah
Messages: 8 Registered: March 2019
|
Member |
|
|
Dear All,
I want to run a logistic regression on stillbirth using the MALawi Data. However, my regression model fails if I do the survey set. I kindly look forward for your kind help
svyset v021 [pweight=wt], strata(v023) vce(linearized) singleunit(missing)
pweight: wt
VCE: linearized
Single unit: missing
Strata 1: v023
SU 1: v021
FPC 1: <zero>
. svy: logistic stillbirths i.v190
(running logistic on estimation sample)
an error occurred when svy executed logistic
r(2000);
Thanks for your kind help in advance
Kind regard
Mamadou
|
|
|
|
Re: malawi [message #17557 is a reply to message #17556] |
Mon, 15 April 2019 13:06 |
mmbah
Messages: 8 Registered: March 2019
|
Member |
|
|
Dear Tom Pullum,
Thank you very much for your kind response. I have used the codes below and the logistic regression worked without error. However, the number of stillbirth has reduced from 236 (DHS final report) to 232 and early neonatal deaths as decrease from 378 (DHS final report) to 338 see below codes and cross tabulations. Thus, I am concern if my calculations are correct. My primary outcome interest is perinatal mortality. Secondly, I generated party by recoding the total births entries (v224) to parity 0,1,2,3,4,5+. However, when I cross tabulated early neonatal deaths and parity, parity 0 had zero early neonatal deaths. This looks weird to me and was concern perhaps something is wrong with my analysis. see below and cross tabulations. I look forward hearing from you soon. Your kind response is very highly solicited.
gen stillbirths = 0
label variable stillbirths "Stillbirths"
gen births = 0
label variable births "Births in calendar"
gen births2 = 0
label variable births2 "Births in birth history"
gen earlyneo = 0
label variable earlyneo "Early neonatal deaths"
gen infant_deaths=0
label variable "infant deaths"
gen child_deaths=0
label variable "child deaths"
gen beg = v018
gen end = v018+59
local vcal_len = strlen(vcal_1[1])
forvalues i = 1/`vcal_len' {
replace births = births+1 if inrange(`i',beg,end) & substr(vcal_1,`i',1) == "B"
replace stillbirths = stillbirths+1 if inrange(`i',beg,end) & substr(vcal_1,`i',7) == "TPPPPPP"
}
replace end = v008
replace beg = v008-59
rename b3_0* b3_*
rename b6_0* b6_*
forvalues i = 1/20 {
replace births2 = births2+1 if inrange(b3_`i',beg,end)
replace earlyneo = earlyneo+1 if inrange(b3_`i',beg,end) & inrange(b6_`i',100,106)
replace infant_deaths = infant_deaths+ 1 if inrange(b3_`i',beg,end) & inrange(b6_`i',100,211)
replace child_deaths = child_deaths+ 1 if inrange(b3_`i',beg,end) & inrange(b6_`i',212,304)
}
gen totpreg7m = births2+stillbirths
label variable totpreg7m "Number of pregnancies of 7+ months duration"
gen perinatal = earlyneo+stillbirths
label variable perinatal "Perinatal mortality"
gen wt = v005/1000000
svyset v021 [pw = wt], strata(v023) singleunit(centered)
svy: tab parity earlyneo, count cellwidth(12) format(%12.2g)
(running tabulate on estimation sample)
Number of strata = 56 Number of obs = 24,562
Number of PSUs = 850 Population size = 24,562
Design df = 794
----------------------------------------------------
| Early neonatal deaths
paritylab | 0 1 Total
----------+-----------------------------------------
0 | 5532 0 5532
1 | 3747 51 3798
2 | 3428 91 3519
3 | 3095 47 3141
4 | 2635 46 2682
5+ | 5787 103 5890
|
Total | 24224 338 24562
----------------------------------------------------
Key: weighted count
Pearson:
Uncorrected chi2(5) = 124.1167
Design-based F(4.84, 3845.21)= 15.1343 P = 0.0000
. svy: tab wealth stillbirths, count cellwidth(12) format(%12.2g)
(running tabulate on estimation sample)
Number of strata = 56 Number of obs = 24,562
Number of PSUs = 850 Population size = 24,562
Design df = 794
----------------------------------------------------
wealth |
index | Stillbirths
combined | 0 1 Total
----------+-----------------------------------------
poorest | 4699 46 4745
poorer | 4641 51 4692
middle | 4584 50 4635
richer | 4653 27 4680
richest | 5752 58 5810
|
Total | 24330 232 24562
----------------------------------------------------
Key: weighted count
Pearson:
Uncorrected chi2(4) = 8.8778
Design-based F(3.85, 3059.99)= 1.2668 P = 0.2814
|
|
|
Re: malawi [message #17608 is a reply to message #17557] |
Fri, 26 April 2019 10:22 |
Bridgette-DHS
Messages: 3214 Registered: February 2013
|
Senior Member |
|
|
Following is another response from Senior DHS Stata Specialist, Tom Pullum:
Sorry for the delay with this response. Perhaps you have already answered the question yourself.
Your Stata code is well written and correct. I have made some modifications and will paste my revised version below. The 232 and 338 are not a problem. The units of analysis in the IR file are women, and the units of analysis for table 8.4 are stillbirths (in column 1) and early neonatal deaths (in column 2). Four women who had two neonatal deaths, and 228 had one. Thus 232 women experienced at least one neonatal death, but the total number of neonatal deaths was 236. You can convert from a file of women to a file of neonatal deaths with the "expand" command, as shown. Similarly for early neonatal deaths.
As you will see, I generally save a working file in a "scratch" folder--you would do something else--in order to move easily from column 1 to column 2 of table 8.4.
Regarding your second question--women with parity 0 have had no live births. That's why they have no early neonatal deaths, even if they may have had stillbirths.
Open MWIR7HFL.dta
gen stillbirths = 0
label variable stillbirths "Stillbirths"
gen births = 0
label variable births "Births in calendar"
gen births2 = 0
label variable births2 "Births in birth history"
gen earlyneo = 0
label variable earlyneo "Early neonatal deaths"
gen infant_deaths=0
label variable infant_deaths "infant deaths"
gen child_deaths=0
label variable child_deaths "child deaths"
gen beg = v018
gen end = v018+59
local vcal_len = strlen(vcal_1[1])
quietly forvalues i = 1/`vcal_len' {
replace births = births+1 if inrange(`i',beg,end) & substr(vcal_1,`i',1) == "B"
replace stillbirths = stillbirths+1 if inrange(`i',beg,end) & substr(vcal_1,`i',7) == "TPPPPPP"
}
replace end = v008
replace beg = v008-59
rename b3_0* b3_*
rename b6_0* b6_*
quietly forvalues i = 1/20 {
replace births2 = births2+1 if inrange(b3_`i',beg,end)
replace earlyneo = earlyneo+1 if inrange(b3_`i',beg,end) & inrange(b6_`i',100,106)
replace infant_deaths = infant_deaths+ 1 if inrange(b3_`i',beg,end) & inrange(b6_`i',100,211)
replace child_deaths = child_deaths+ 1 if inrange(b3_`i',beg,end) & inrange(b6_`i',212,304)
}
gen totpreg7m = births2+stillbirths
label variable totpreg7m "Number of pregnancies of 7+ months duration"
gen perinatal = earlyneo+stillbirths
label variable perinatal "Perinatal mortality"
gen wt = v005/1000000
gen parity=v224
replace parity=5 if parity>5
label variable parity "Parity"
label define parity 5 "5+"
label values parity parity
svyset v021 [pw = wt], strata(v023) singleunit(centered)
svy: tab parity earlyneo, count cellwidth(12) format(%12.2g)
save e:\DHS\DHS_data\scratch\temp.dta, replace
tab stillbirths if stillbirths>0 [iweight=v005/1000000]
expand stillbirths
tab stillbirths if stillbirths>0 [iweight=v005/1000000]
* get column 1 of table 8.4 from this file
use e:\DHS\DHS_data\scratch\temp.dta, clear
tab earlyneo if earlyneo>0 [iweight=v005/1000000]
expand earlyneo
tab earlyneo if earlyneo if earlyneo>0 [iweight=v005/1000000]
* get column 2 of table 8.4 from this file
|
|
|
Re: malawi [message #17616 is a reply to message #17608] |
Fri, 26 April 2019 15:31 |
mmbah
Messages: 8 Registered: March 2019
|
Member |
|
|
Dear Tom,
Thank you very much for that invaluable response. It has really help a lots.
Regards
mamadou
|
|
|
Goto Forum:
Current Time: Sun Dec 22 04:01:57 Coordinated Universal Time 2024
|