Household Dietary Diversity

# Table 6: Food groups consumed by ≥50% of households by dietary diversity
# HDDS.pdf pag.31
dfSEtmp <- inner_join(dfSE %>% mutate(city=paste(country,city,sep="_")),
                   dfSE %>% mutate_at(.vars = 116:133,~ifelse(.=="Yes",1,0)) %>% 
                     rowwise() %>% 
                     # mutate(HDDS_Tot = sum(c_across(HDDS_01:HDDS_18))) %>% 
                     mutate(HH_size=adult14plus+child3to13+child0to2) %>% 
                     mutate(HD01.Cereals=HDDS_01,
                            HD02.Green.leafy.vegetables=ifelse((HDDS_04+HDDS_03)>0,1,0),
                            HD03.Vitamin.A.rich.fruit=HDDS_06,
                            HD04.Oil=HDDS_15,
                            HD05.Other.vegetables=HDDS_05,
                            HD06.Fish=HDDS_11,
                            HD07.Legumes.nuts.seeds=ifelse((HDDS_12+HDDS_13)>0,1,0)) %>% 
                     select(unique_id,HD01.Cereals:HD07.Legumes.nuts.seeds),
                   by="unique_id") %>% 
  mutate(HD7.Tot=HD01.Cereals+HD02.Green.leafy.vegetables+HD03.Vitamin.A.rich.fruit+HD04.Oil+HD05.Other.vegetables+HD06.Fish+HD07.Legumes.nuts.seeds)

dfSE <- inner_join(dfSE,
                  dfSE %>% mutate_at(.vars = 116:133,~ifelse(.=="Yes",1,0)) %>% 
                    rowwise() %>% 
                    # mutate(HDDS_Tot = sum(c_across(HDDS_01:HDDS_18))) %>% 
                    mutate(HH_size=adult14plus+child3to13+child0to2) %>% 
                    mutate(H01.Cereals=HDDS_01,
                           H02.White.tubers.roots=HDDS_02,
                           H03.Vegetables=ifelse((HDDS_03+HDDS_04+HDDS_05)>0,1,0),
                           H04.Fruits=ifelse((HDDS_06+HDDS_07)>0,1,0),
                           H05.Meat=ifelse((HDDS_08+HDDS_09)>0,1,0),
                           H06.Eggs=HDDS_10,
                           H07.Fish=HDDS_11,
                           H08.Legumes.nuts.seeds=ifelse((HDDS_12+HDDS_13)>0,1,0),
                           H09.Milk=HDDS_14,
                           H10.Oils.fats=HDDS_15,
                           H11.Sweets=HDDS_16,
                           H12.Spices.condiments.beverages=ifelse((HDDS_17+HDDS_18)>0,1,0)) %>% 
                    mutate(HDDS12.Tot=H01.Cereals+H02.White.tubers.roots+H03.Vegetables+H04.Fruits+H05.Meat+H06.Eggs+H07.Fish+H08.Legumes.nuts.seeds+H09.Milk+H10.Oils.fats+H11.Sweets+H12.Spices.condiments.beverages) %>% 
                    select(unique_id,HH_size:HDDS12.Tot),
                  by="unique_id")

aggregate variables

educ in 3 classes, hh_head_employ in 3 classes and presence of children

dfSE <- dfSE %>% mutate(educ3 = factor(ifelse(is.na(educ),NA,
                                            ifelse(educ %in% levels(dfSE$educ)[1:2],educ,3)),
                                     levels=1:3,
                                     labels=c(levels(dfSE$educ)[1:2],"Secondary or more"))) 
dfSE <- dfSE %>% mutate(hh_head_employ_3=ifelse(hh_head_employ %in% c("Unemployed","Casual worker (paid by the day)"),1,
                                        ifelse(hh_head_employ %in% c("Sole trader","Businessman / self-employed","Other"),2,
                                               ifelse(hh_head_employ %in% c("Clerk (formal employment)","Manager","Regular worker"),3,NA))))
dfSE$hh_head_employ_3 <- factor(dfSE$hh_head_employ_3,levels = 1:3,labels = c("Unemployed.Casual","self.employed","Clerk.Regular.Manager"))

dfSE$children0_2 <- factor(ifelse(is.na(dfSE$child0to2),NA,ifelse(dfSE$child0to2>0,1,0)),levels = 0:1,labels = c("No","Yes"))
dfSE$children3_13 <- factor(ifelse(is.na(dfSE$child3to13),NA,ifelse(dfSE$child3to13>0,1,0)),levels = 0:1,labels = c("No","Yes"))

variable aggregation on innovation

a single summary variable was created between local_food_interest and nutri_food_interest

some reasons for choosing innovative products and some obstacles were then aggregated (see tables below)

methodology used: confirmatory factor analysis


# variables in analysis
cbind(names(dfSE.HD)[1:39])
##       [,1]                 
##  [1,] "HDDS12.Tot"         
##  [2,] "country"            
##  [3,] "city"               
##  [4,] "gender"             
##  [5,] "age"                
##  [6,] "HH_size"            
##  [7,] "children0_2"        
##  [8,] "children3_13"       
##  [9,] "educ3"              
## [10,] "income_avg"         
## [11,] "hh_salary"          
## [12,] "hh_head_employ_3"   
## [13,] "income_food"        
## [14,] "imp_availability"   
## [15,] "imp_nutrition"      
## [16,] "imp_provider"       
## [17,] "imp_price"          
## [18,] "imp_envfriend"      
## [19,] "imp_divers"         
## [20,] "imp_tradition"      
## [21,] "imp_local"          
## [22,] "imp_product"        
## [23,] "healty_diet"        
## [24,] "local_food"         
## [25,] "meet_food_needs"    
## [26,] "lacking"            
## [27,] "innov_food_interest"
## [28,] "Obstacle.habits"    
## [29,] "Obstacle.healthy"   
## [30,] "Obstacle.price"     
## [31,] "Obstacle.taste"     
## [32,] "Obstacle.trust"     
## [33,] "Reason.availability"
## [34,] "Reason.culture"     
## [35,] "Reason.farmers"     
## [36,] "Reason.status"      
## [37,] "Reason.trust"       
## [38,] "Reason.wellness"    
## [39,] "yest_celebration"

model 1

mod.HD <- lm(HDDS12.Tot~.,data=dfSE.HD)
tbm1a <- lm2df(mod.HD)
tbm1b <- Anova2df(mod.HD)

my.flextb(tbm1a,title = "model 1 - coefficients") %>% autofit()
my.flextb(tbm1b,title = "model 1 - anova") %>% autofit()

model 1 - stepwise BIC

mod.HD.s <- my.stepwise(mod.HD,direction = "both",crit = "bic")
lmb.s <- lm.beta(mod.HD.s)

tbm1a <- lm2df(mod.HD.s)
tbm1a$Std.Estimate <- NA
tbm1a$Std.Estimate[1:29] <- round(lmb.s$standardized.coefficients,4)
tbm1b <- Anova2df(mod.HD.s)
my.flextb(tbm1a,title = "model 1 - stepwise BIC - coefficients") %>% autofit()
my.flextb(tbm1b,title = "model 1 - stepwise BIC - anova") %>% autofit()
tbm1c <- ols_vif_tol(mod.HD.s)
my.flextb(tbm1c,title = "model 1 - stepwise BIC - VIF") %>% autofit()
lm.resid.plots(mod.HD.s)

tbm1d <- test2df(ks.test(mod.HD.s$residuals, 'pnorm'),test="s")
my.flextb(tbm1d,title = "model 1 - stepwise BIC - residuals normality test") %>% autofit()

model 1 - stepwise AIC

mod.HD.sA <- my.stepwise(mod.HD,direction = "both",crit = "aic")
lmb.sA <- lm.beta(mod.HD.sA)
tbLM <- lm2df(mod.HD.sA)
tbLM$Std.Estimate <- NA
tbLM$Std.Estimate[1:41] <- round(lmb.sA$standardized.coefficients,4)
tbAN <- Anova2df(mod.HD.sA)
my.flextb(tbLM,title = "model 1 - stepwise AIC - coefficients") %>% autofit()
my.flextb(tbAN,title = "model 1 - stepwise AIC - anova") %>% autofit()
tbVIFa <- ols_vif_tol(mod.HD.sA)
my.flextb(tbVIFa,title = "model 1 - stepwise AIC - VIF") %>% autofit()
lm.resid.plots(mod.HD.sA)

tbm1da <- test2df(ks.test(mod.HD.sA$residuals, 'pnorm'),test="s")
my.flextb(tbm1da,title = "model 1 - stepwise AIC - residuals normality test") %>% autofit()

model 1 - by country

risulati per paese dopo procedura stewise (AIC)

model 2 - yest_celebration = “No”

model 2 - yest_celebration = “No” - stepwise

model 3 - HDDS and experiments

Lacking products

model 1

model 1 - stepwise AIC

model 1 - stepwise BIC