The DHS Program User Forum
Discussions regarding The DHS Program data and results
Home » Topics » Nutrition and Anthropometry » Calculation of median exclusive breastfeeding
Calculation of median exclusive breastfeeding Sun, 04 December 2016 13:49
 anarinaldi Messages: 13Registered: December 2016 Location: Uberlandia - Brazil Member
My colleagues and I are working with DHS datasets, specifically about breastfeeding. We are calculating the exclusive breastfeeding median using the formula available in the page 124 of material "Guide to DHS Statistics" (median = mi-1 + (pi-1 0.5)/(pi-1 pi ) x (w i)).
Our doubt is how to calculate the median when the first proportion of breastfeeding (pi) is lower than 50%. Besides, how to calculate when the proportion of breastfeeding in the last age range (4-5months) is higher than 50%.
Re: Calculation of median exclusive breastfeeding [message #11364 is a reply to message #11314] Fri, 09 December 2016 12:54
 Liz-DHS Messages: 1516Registered: February 2013 Senior Member
Dear User,
A response from Dr. Tom Pullum:
Quote:

If the proportion in the first interval is less than .50, then I think it would be best just to say that the median duration is <1 month. If the proportion in the final interval is more than .50, then it would be best to say that the median duration is greater than the final month in your data.

The DHS calculation is not simple. It may change in the future to use day of birth, not just the month and year of birth (and the surveys always give the day, month, and year of interview). If you are having difficulty matching the DHS calculation, please tell me what survey you are using.

Re: Calculation of median exclusive breastfeeding [message #12336 is a reply to message #11364] Tue, 02 May 2017 18:48
 voddo Messages: 6Registered: February 2016 Member
I'm working on a cross-country analysis - using ~ 50 DHS datasets and am having a hard time with the median duration of breastfeeding variable. Per the stats users guide its a moving median and since I'm using so many countries of data I'm hoping to generate this variable using a loop. Would you be able to provide any stata code to appropriately estimate median duration of BF?

thank you!
Re: Calculation of median exclusive breastfeeding [message #12342 is a reply to message #12336] Wed, 03 May 2017 13:29
 anarinaldi Messages: 13Registered: December 2016 Location: Uberlandia - Brazil Member
Thanks
Re: Calculation of median exclusive breastfeeding [message #12343 is a reply to message #12342] Wed, 03 May 2017 13:33
 voddo Messages: 6Registered: February 2016 Member
Yes, I am trying to calc median duration based on current status. I was getting a bit confused re: the moving average and percentile smoothing (that I saw on another thread). Many thanks for your help.
Re: Calculation of median exclusive breastfeeding [message #12344 is a reply to message #12343] Wed, 03 May 2017 14:02
 anarinaldi Messages: 13Registered: December 2016 Location: Uberlandia - Brazil Member
Hello Voddo:

I use a publication of WHO: http://apps.who.int/iris/bitstream/10665/44306/1/97892415992 90_eng.pdf
In the Annex 5 (page 78) there is one explanation.
I wrote about this calculation in one article (in revision). In my case I calculate for exclusive breastfeeding.

For current status data, the first step was to obtain a distribution of infants by three age range (0 to 1.9 months, 2 to 3.9 months and 4 to 5.9 months). The distribution was smoothed by a moving average of three groups (previous, current and following value of the distribution) and divided by 3. The second step was to calculate the percentages of infants classified as exclusively breastfed in each age range. The third step was to calculate the median of exclusive breastfeeding by linear interpolation between the midpoint of the first age range for which the proportion falls below 50% and next youngest midpoint age range. This procedure is recommended by DHS Guidelines to calculate median for current status data, and by WHO(4). The final equation to calculate the median is described below (Figure 2). The median of exclusive breastfeeding using current status was calculated only for infants under 6 months.

I send the commands in Stata. I calculated the duration country by country. I didn't use loop, but I using the sintaxe that I use, it can be prepared.

First, it is necessary to generate a variable that indicate if each child is or not breastfed at present moment (yes=1 and no=0)
After, you generate a variable about age range (2 months of each interval) and a variable that indicates the situation of breastfeeding (yes/no) by age range
After, you need to collapse the dataset to calculate the moving average and after then the median duration.

collapse (count) BF [aw= SAMPLING], by(AGE_RANGE BF_AGE)
reshape wide BF,i(AGE_RANGE)j(BF_AGE)
egen freqtotal=rowtotal(BF_AGE0 BF_AGE1)
gen meanmovel= (freqtotal[_n-1]+freqtotal[_n]+freqtotal[_n+1])/3
replace meanmovel=(BF_AGE0+BF_AGE1) if AGE_RANGE==1
replace meanmovel=(BF_AGE0+BF_AGE1) if AGE_RANGE== (PUT THE LAST VALUE OF INTERVAL)
gen meanmovelBF= (BF_AME1[_n-1]+BF_AME1[_n]+BF_AME1[_n+1])/3
replace meanmovelBF=BF_AME1 in 1
replace meanmovelBF = BF_AME1 in 6 (PUT THE LAST VALUE OF INTERVAL)
gen freqBF=BF_AME1/meanmovelBF

After you calculate the median duration using formule available at publication of WHO (annex 5).

I don't know if the information is easy to understand.
Re: Calculation of median exclusive breastfeeding [message #12349 is a reply to message #12344] Wed, 03 May 2017 16:56
 voddo Messages: 6Registered: February 2016 Member
Yes, thank you very much! This is very helpful.
Re: Calculation of median exclusive breastfeeding [message #14089 is a reply to message #12349] Tue, 13 February 2018 15:36
 Radhika_DHS Messages: 4Registered: January 2018 Location: India Member
Hi
I am trying to compute median duration of any breastfeeding for last born child under three years from NFHS 4 data for India, I have followed WHO document for Indicators for assessing infant and young child feeding practices, Annex 5 Instructions for calculating duration of breastfeeding, pg 78, but my result is coming very different from report, I have taken m4 variable to compute currently breastfeeding, looking for input.

Thanks