**Topic Determinants of patients'choice of Healthcare Providers**
**Variables for multivariable regression**
**Dependent Variable**
**Healthcare Providers**
tab Q_223
gen HC_Provider=Q_223 
recode HC_Provider (1 2 3 4 5=1) (6 7=2) (9 10 11 12 13=3) (14 15=4) (8 16 17=5)
label variable HC_Provider "Provider_choice"
label define Provider_choice 1 "Public" 2 "Faith_based" 3 "Private" 4 "Tradional" 5"Others"
label values HC_Provider Provider_choice 
drop if HC_Provider==.
tab HC_Provider

**Independent Variables**
**1. Socio-demographic factors**
***Education level attained
tab Q_208
codebook Q_208
gen Educ=Q_208
recode Educ (1=1) (2=2) (4 =3) (3 5 6=4) (7=5)
label define Educ 1 "Preschool" 2 "Primary" 3 "Secondary" 4 "Tertiary" 5 "Dont-know"
label values Educ Educ
drop if Educ==.
tab Educ

***Gender
gen Gender=Q_204 
tab Gender
label variable Gender "Gender"
label define gender 1 "Male" 2 "Female"
label values Gender gender
tab Gender

***Family size
tab Q_200a
gen Family_size=Q_200a
hist Family_size, normal
sum Family_size
**Report mean**
recode Family_size min/6=1 7/max=2
label variable Family_size "Family_size"
label define members 1 "<=6" 2 ">6"
label values Family_size members
tab Family_size

****Age
gen agegroupcat=Q_206
hist agegroupcat, normal
sum agegroupcat, d
**Report median and IQR**
recode agegroupcat 0/14=1 15/49=2 50/max=3
label variable agegroupcat "agegroupcat"
label define years_old 1 "<15" 2 "15-49" 3 ">=50"
label values agegroupcat years_old
tab agegroupcat

****Place of residence**
gen Residence=region 
label variable Residence "Residence"
label define place 1 "Rural" 2 "Urban"
label values Residence place
tab Residence

***Income
tab quintile //wealth quintile used to calculate HH onwership of selected items
gen wealth_quint=quintile
recode wealth_quint (1=5)(2=4) (3=3) (4=2) (5=1)
label variable wealth_quint "wealth_quint"
label define Proxy 1 "Poorest" 2 "Fourth" 3 "Middle" 4 "Second" 5"Richest"
label values wealth_quint Proxy
tab wealth_quint

***Occupation status 
gen Occupation=Q_211 
recode Occupation 6=1 1=2 3 4 5 7=3
label variable Occupation "Occupation"
label define employed 1 "Self-employment" 2 "Paid employee" 3"Others"
label values Occupation employed
tab Occupation

**Health Access factors***
*** distance
tab Q_408_1
**check if distance is normally distributed** 
hist Q_408_1, normal 
gen distance=Q_408_1
sum distance, d
**Report median**
recode distance 0/4.9=1 5/9.9=2 10/max=3
label variable distance "distance"
label define km_covered 1 "<5km" 2 "5-9.9km" 3 ">=10km"
label values distance km_covered
tab distance

***Availability of drugs
gen Avail_drugs=Q_228_A 
recode Avail_drugs (1 2=1) (3=2) (4 5=3)(6=4)
label variable Avail_drugs "Avail_drugs label"
label define Drugs 1"poor" 2 "Average" 3 "Good" 4 "Not applicable"
label values Avail_drugs Drugs
tab Avail_drugs

***Qualified staff

gen Qualified_staff=Q_228_B 
recode Qualified_staff (1 2=1) (3=2) (4 5=3) (6=4)
label variable Qualified_staff "Qualified_staff label"
label define staff 1 "Poor" 2 "Average" 3 "Good" 4 "Not applicable"
label values Qualified_staff staff
tab Qualified_staff

***Waitng time
gen Waiting_time=Q_228_C 
recode Waiting_time (1 2=1) (3=2) (4 5=3) (6 7=4)
label variable Waiting_time "Waiting_time_label"
label define time 1 "Poor" 2 "Average" 3 "Good" 4 "Not applicable"
label values Waiting_time time
tab Waiting_time

***Attitude
gen Attitude=Q_228_F 
recode Attitude (1 2=1) (3=2) (4 5=3) (6=4)
label variable Attitude "Attitude_label"
label define attitude 1 "Poor" 2 "Average" 3 "Good" 4 "Not applicable"
label values Attitude attitude
tab Attitude

**Type of Illness***
gen condition=0
replace condition=1 if Q_218_A ==1
replace condition=1 if Q_218_B ==1
replace condition=1 if Q_218_C ==1
replace condition=1 if Q_218_D ==1
replace condition=1 if Q_218_E ==1
replace condition=1 if Q_218_F ==1
replace condition=1 if Q_218_G ==1
replace condition=1 if Q_218_H ==1
replace condition=1 if Q_218_I ==1
tab condition
label variable condition "condition"
label define illness_type 1 "Chronic" 2 "Non Chronic"
label values condition illness_type
tab condition
recode condition (0=1) (1=2)
tab condition

svyset cluster [pweight= FinalWeightNew ], strata(Residence) vce(linearized) singleunit(missing)

**Proportions**
svy linearized : proportion HC_Provider
svy linearized : proportion agegroupcat
svy linearized : proportion Gender
svy linearized : proportion Family_size
svy linearized : proportion Residence
svy linearized : proportion Educ
svy linearized : proportion Occupation
svy linearized : proportion wealth_quint
svy linearized : proportion distance
svy linearized : proportion Qualified_staff
svy linearized : proportion Waiting_time
svy linearized : proportion Attitude
svy linearized : proportion Avail_drugs
svy linearized : proportion condition

***Mutinomial logistic regression HC_Provider as dependent variable with 5 choices**
***run the regression while gradually add variables**
**the regression coud not rn with HC_Provider having choices 4 and 5 because some variables had empty cells*
drop if HC_Provider==5
drop if HC_Provider==4
**The variable occupation was dropped due to missing values which affected the results of the final model**


**Dependent Variable with 3 choices at 95%**
svy linearized : mlogit HC_Provider i. agegroupcat i.Gender i.Family_size i.Residence i.wealth_quint i.distance i. Qualified_staff i. Waiting_time  i. Attitude i. Avail_drugs i.condition i. Educ, rrr
***Dependent variable with 3 choices at 99%**
svy linearized : mlogit HC_Provider i. agegroupcat i.Gender i.Family_size i.Residence i.wealth_quint i.distance i. Qualified_staff i. Waiting_time  i. Attitude i. Avail_drugs i.condition i. Educ, level(99) rrr


***mlogtest, hausman base tests for IIA Assumption of independence*
estimates store HC_Provider3//An estimation with all the 3 alternatives
gen HCPF=HC_Provider if HC_Provider!=3
svy linearized : mlogit HCPF i. agegroupcat i.Gender i.Family_size i.Residence i.wealth_quint i.distance i. Qualified_staff i. Waiting_time  i. Attitude i. Avail_drugs i.condition i. Educ, level(99) rrr
estimates store HC_Providerfaith//Estimate with Faithbased HCP as the only alternative
gen HCPP=HC_Provider if HC_Provider!=2
svy linearized : mlogit HCPP i. agegroupcat i.Gender i.Family_size i.Residence i.wealth_quint i.distance i. Qualified_staff i. Waiting_time  i. Attitude i. Avail_drugs i.condition i. Educ, level(99) rrr
estimates store HC_Providerprofit//Estimate with Private for profit HCP as the only alternative

*estimates table m1 m2 m3***
estimates dir
***Using suest with survey data to obtain variance estimates for estimators that used svy prefix***
suest HC_Provider3 HC_Providerfaith, svy
***adjusted wald test***
test [m1_Public = m1_Faith_based], cons 
suest HC_Provider3 HC_ProviderProfit

test [H5_health=H3_health3]
suest m1 m3, noomitted
test [m1_Public = m1_Private], cons
test [m1_Public = m3_2], cons
suest m*, noomitted


hausman m2 m1, alleqs constant

hausman m3 m1, alleqs constant
suest m1 m2, noomitted

test [m1_2 = m2_2], cons
suest m1 m3, noomitted
test [m1_1 = m3_1], cons
suest m*, noomitted
test [m1_2 = m2_2] , cons notest
test [m1_1 = m3_1], cons acc

