# Use the 2000 EDHS Dataset library(haven) library(tidyr) library(dplyr) library(lme4) library(nlme) # 1st read the csv file, BMI_obov is the outcome var. ETIR41FL <- read.csv("ETIR41FL_ovob.csv") # Filtering the non-flagged casses of BMI(v445), the non-pregnant women(v213) # and non-postpartum women, (v222) from the whole dataset. # ETIR41FL_M <- ETIR41FL %>% filter(v445!=9998, v213=="0", v222>"2") # View(ETIR41FL_M) #Removing all the NA(take only the completed cases) ETIR41FL_N <- ETIR41FL_M[which(complete.cases (ETIR41FL_M[,c('AgeCat','v106','v130','v313','MaritalSt','v714','Freq_newsp', 'Freq_radio','Freq_tv','Parity','Partner_edu', 'v024','v025','Com_edu')])),] #2nd Model Nutri_Multi2 <- glmer(BMI_obov2~as.factor(AgeCat)+as.factor(v106)+as.factor(v130)+ as.factor(v313)+ as.factor(MaritalSt)+ as.factor(v714)+ as.factor(Freq_newsp)+ as.factor(Freq_radio)+ as.factor(Freq_tv)+ as.factor(Parity)+ as.factor(Partner_edu)+ (1|v024), family=binomial, weights=ETIR41FL_N$WGT, data=ETIR41FL_N, na.action=na.omit) summary(Nutri_Multi2) # 3rd Model II (containing only community level factors) and we changed the previous community # level variable Com_urbanP by Com_PlRes. Nutri_Multi3 <- glmer(BMI_obov2~as.factor(v024)+as.factor(v025)+ as.factor(Com_edu)+ (1|v024), family=binomial,weights=ETIR41FL_N$WGT, data=ETIR41FL_N, na.action=na.omit) summary(Nutri_Multi3)