Home » Topics » General » Wrong numbers
Wrong numbers [message #1958] |
Fri, 11 April 2014 11:52 |
Mercysh
Messages: 35 Registered: April 2014
|
Member |
|
|
Please help, the totals that I am getting are higher than those published in the reports
Mercy
|
|
|
|
|
|
|
|
|
|
|
|
Re: Wrong numbers [message #8446 is a reply to message #8437] |
Wed, 28 October 2015 10:30 |
Trevor-DHS
Messages: 805 Registered: January 2013
|
Senior Member |
|
|
Your code does not take into account a few things:
1) The code did not consider whether the father or mother was dead. This is added by checking for . in the recode statements.
2) In Lesotho all family members are listed in the household schedule, including those that do not usually live in the household. To see if they live together you need to check if both the child and the parent usually live in the household. The important piece for this is to check hv102 for the father or mother. This is done with the following logic:
hv102[_n-hvidx+hv114] != 1
This logic refers to the data record for the father (or mother) by taking the current record number (_n), subtracting the child's line number (hvidx) to find the record before the start of the household, and then adding the father's (or mother's) line number (hv114 or hv112) to find the record for the parent. For this to work, all household members must be kept in the dataset, so the "keep if" commands have been removed, and the selection for children under 18 who were usual members of the household has been put on the svy:tab command instead (if hv102==1 & hv105 <= 17).
3) The code also needs to take into account cases where it was unknown if the father or mother was still alive, that is if hv113 was 8 or 9, or hv111 was 8 or 9.
Try the below code:
use LSPR60FL.DTA, clear
generate weight= hv005/1000000
svyset [pw=weight], psu(hv021) strata(hv022)
* sort to ensure that the household listing is in order
sort hhid hvidx
*Living arrangements of children
recode hv114 (0=0 "Not present") (1/30 = 1 "Present") (.=0), gen(father_presence)
recode hv112 (0=0 "Not present") (1/30 = 1 "Present") (.=0), gen(mother_presence)
replace father_presence=9 if inrange(hv113,8,9)
replace mother_presence=9 if inrange(hv111,8,9)
* need to take into acount whether father or mother usually live in the household
replace father_presence=0 if father_presence==1 & hv102[_n-hvidx+hv114] != 1
replace mother_presence=0 if mother_presence==1 & hv102[_n-hvidx+hv112] != 1
*
gen parental_presence = 9
replace parental_presence = 1 if father_presence == 1 & mother_presence == 1
replace parental_presence = 2 if father_presence == 1 & mother_presence == 0
replace parental_presence = 3 if father_presence == 0 & mother_presence == 1
replace parental_presence = 4 if father_presence == 0 & mother_presence == 0
label var parental_presence parental_presence
label define parental_presence 1 "Both" 2 "Father only" 3 "Mother only" 4 "None" 9 "DK/Missing"
label val parental_presence parental_presence
svy:tab parental_presence if hv102==1 & hv105 <= 17
|
|
|
Re: Wrong numbers [message #12742 is a reply to message #8446] |
Thu, 06 July 2017 12:01 |
Mercysh
Messages: 35 Registered: April 2014
|
Member |
|
|
I have two follow up questions on the response below:
1. I want to categorise children whose parents are de jure household members, whose parents are migrants (living elsewhere for extended periods), those whose parents are not part of the household because they are dead or are "absent". I am having challenges to do it in stata. I copied your code below for the first two categories but having problems with the rest.
2. Are there other countries besides Lesotho that include individuals who are neither de jure nor de facto members?
Mercy
[Updated on: Sun, 09 July 2017 07:57] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Tue Jan 21 23:07:44 Coordinated Universal Time 2025
|