Draft R Code - achafetz/RetentionAnalysis GitHub Wiki
Psuedo coding for R analysis
District Names Crosswalk
- import district crosswalk file
AIS data
- import AIS data
- merge AIS with district names (due to mismatch)
- aggregate data to district level
- recreate percent variable for aggregated districts
EA data
- import PEPFAR FY16 expenditure data
- keep only district level totals for retention expenditures
national_sub_unit datim_snu_id cbcts_lnkg_exp cbcts_rtnadhr_exp fbcts_loaded_tot
- merge with district crosswalk file
MER data
- import ICPI Fact View FY16 Q4 data
- keep if
operatingunit
= Boswana andindicator
=TX_RET
(numerator & denominator) - aggregate to district level
- reshape wide
- create retention percentage by district
IMPATT data
- import ICPI IMPATT data
- keep if
operatingunit
= Boswana andindicator
=PLHIV
&TX_CURR_SUBNAT
- reshape wide
Merge & Analyze
- merge all datasets together
- perform logit regression using survey, expenditure, and results data