Closed athowes closed 2 years ago
calc_survey_indicators
is the function used everywhere to calculate proportions by stratificationThe relevant PHIA surveys are:
The steps needed I think are:
survey_meta
survey_regions
bind_rows
) to use one call of calc_survey_indicators
Want to replicate this section of create_sexbehav_dhs
(including the Adam adjustments at the end)
To-do on this tomorrow:
survey_sexbehav
object in lso_survey_phia
, save as artefactlso_survey_behav
and attempt to run calc_survey_indicators
on the PHIA data, then merge the results with that of running calc_survey_indicators
for the DHS data (alternatively attempt to merge the PHIA data with the DHS data and run calc_survey_indicators
once)Based on the below call, it looks like everyone who is in not exactly one category is in none of them. Hopeful that this can be fixed.
> survey_sexbehav %>%
+ mutate(
+ r_tot = nosex12m + sexcohab + sexnonreg + sexpaid12m
+ ) %>%
+ filter(
+ r_tot != 1
+ ) %>%
+ summary()
survey_id individual_id sex12m nosex12m sexcohab sexnonreg sexpaid12m sexnonregplus r_tot
Length:119 Length:119 Min. :1 Min. :0 Min. :0 Min. :0 Min. :0 Min. :0 Min. :0
Class :character Class :character 1st Qu.:1 1st Qu.:0 1st Qu.:0 1st Qu.:0 1st Qu.:0 1st Qu.:0 1st Qu.:0
Mode :character Mode :character Median :1 Median :0 Median :0 Median :0 Median :0 Median :0 Median :0
Mean :1 Mean :0 Mean :0 Mean :0 Mean :0 Mean :0 Mean :0
3rd Qu.:1 3rd Qu.:0 3rd Qu.:0 3rd Qu.:0 3rd Qu.:0 3rd Qu.:0 3rd Qu.:0
Max. :1 Max. :0 Max. :0 Max. :0 Max. :0 Max. :0 Max. :0
Let NIQ be "not in questionnaire". Here are the list of deviations away from LEPHIA, probably need to be dealt with a bit manually:
Survey | Variable | Issue | Fixed? |
---|---|---|---|
ZimPHIA | analsxever |
sex is defined as either anal or vaginal | Y: removed check for anal sex |
ZimPHIA | lifetimesex , lifetimesexdk |
NIQ | Y: not using |
ZimPHIA | part12modkr |
called part12monumdk instead |
Y |
ZamPHIA | analsxever |
called ansxfrstage instead |
Y: removed check for anal sex |
ZamPHIA | lifetimesex , lifetimesexdk |
called partlifetm , partlifetmdk instead |
Y: not using |
ZamPHIA | part12monum |
called part12mo instead |
Y |
UPHIA | analsxever |
sex is defined as either anal or vaginal | Y: removed check for anal sex |
UPHIA | sellsx12mo |
NIQ | Y |
UPHIA | buysx12mo |
NIQ | Y |
THIS | lifetimesex , lifetimesexdk |
NIQ | Y: not using |
THIS | partlastsxtimed1 , partlastsxtimed2 , partlastsxtimed3 |
NIQ | Y: not using |
SHIMS2 | sellsx12mo |
in questionnaire but not in our ind extract (why?) |
Y (email pending) |
NAMPHIA | analsxever |
has kindsex_a , kindsex_b , ... instead. Also skips section if no vaginal sex |
Y: removed check for anal sex |
NAMPHIA | partlastsxtimed1 , partlastsxtimed2 , partlastsxtimed3 |
NIQ | Y |
MPHIA | analsxever |
called ansxyn instead |
Y: removed check for anal sex |
MPHIA | lifetimesex , lifetimesexdk |
NIQ | Y: not using |
MPHIA | part12modkr |
called part12monumdk instead |
Y |
CAMPHIA | analsxever |
ever had sex defined via evrhdsx "Sex can be when a penis enters a vagina, when a penis enters an anus, or when a person puts his/her mouth on the penis or vagina of another person." |
Y: removed check for anal sex |
CAMPHIA | partlastsxtimed1 , partlastsxtimed2 , partlastsxtimed3 |
NIQ | Y: not using |
CAMPHIA | sellsx12mo |
NIQ | Y |
Running through the combination pipeline for ZWE as example:
zwe_survey_phia
run and commitzwe_survey_sexbehav
run and commitsexpaid12m
.naomi.utils
aaa_survey_behav
failed on the following. Find way to fix:
Error in assign_dhs_cluster_areas(survey_clusters, survey_region_areas) :
Survey clusters have survey_region_id not contained in survey_regions:
survey_id survey_region_id cluster_id
1 TZA2007AIS 54 4
2 TZA2007AIS 53 11
3 TZA2007AIS 51 13
4 TZA2007AIS 51 16
5 TZA2007AIS 52 18
6 TZA2007AIS 53 26
7 TZA2007AIS 54 27
8 TZA2007AIS 54 34
9 TZA2007AIS 53 41
10 TZA2007AIS 55 42
11 TZA2007AIS 53 46
12 TZA2007AIS 55 47
13 TZA2007AIS 51 49
14 TZA2007AIS 55 51
15 TZA2007AIS 55 54
16 TZA2007AIS 53 61
17 TZA2007AIS 52 68
18 TZA2007AIS 52 78
19 TZA2007AIS 51 88
20 TZA2007AIS 52 91
21 TZA2007AIS 52
Kinh says that he has seen this error before and it was fixed by switching to a development branch of naomi.utils
.
The PHIA part of this is done, so closing and adding new issue relating to adding new DHS surveys back to 1994 #46
sexcohab
sexcohab
Fixed those zeros in sexcohab
by changing the sexbehav-vars-adam
branch of naomi.utils
. All good now I think!