Introduction

This paper analyses the influence of the level of economic development on the dietary habits of citizens in various countries between 2010 and 2015. A dataset of economic, health and food consumption indicators is used to identify patterns and significant differences in diet according to the level of development.

The dataset covers information from 150 observations from 30 countries between 2010 and 2015, including economic variables such as GDP and the Human Development Index, health indicators and detailed measures of dietary consumption. This diversity of variables allows for a comprehensive analysis linking socio-economic context to dietary habits,

obj1 <- read.csv("cantcalesperanza_final2.csv")
str(obj1)
## 'data.frame':    150 obs. of  17 variables:
##  $ Pais             : chr  "Austria" "Austria" "Austria" "Austria" ...
##  $ Año              : int  2010 2011 2012 2013 2014 2015 2010 2011 2012 2013 ...
##  $ Estatus          : chr  "Developed" "Developed" "Developed" "Developed" ...
##  $ Esperanza.de.vida: num  84 88 88 81.1 81.4 81.5 80 83 83 87 ...
##  $ Mortalidad.adulta: int  75 73 7 68 66 65 81 8 78 77 ...
##  $ Porcentaje.gastos: num  7423.2 8272.3 7878.4 90.6 8350.2 ...
##  $ IDH              : num  0.872 0.88 0.884 0.887 0.892 0.892 0.878 0.884 0.886 0.889 ...
##  $ PIB              : num  84 88 88 81.1 81.4 81.5 80 83 83 87 ...
##  $ IMC              : num  55.2 55.7 56.1 56.6 57.1 57.6 61.9 62.3 62.6 63 ...
##  $ Total.kcal       : int  3724 3735 3739 3768 3672 3664 3707 3720 3715 3733 ...
##  $ Vegetal.kcal     : int  2621 2632 2631 2631 2539 2503 2605 2572 2566 2561 ...
##  $ Animal.kcal      : int  1103 1104 1108 1137 1133 1161 1102 1147 1149 1172 ...
##  $ GrasasAnim       : num  263 259 281 269 233 ...
##  $ Verduras         : num  56.3 59.2 58.6 56.8 57.4 ...
##  $ Fruits..other    : num  40.5 43.3 40.2 43.1 38.8 ...
##  $ Azucar           : num  419 423 417 402 404 ...
##  $ Cereales         : num  15.1 23.2 27 18.9 18.3 ...
summary(obj1)
##      Pais                Año         Estatus          Esperanza.de.vida
##  Length:150         Min.   :2010   Length:150         Min.   :72.40    
##  Class :character   1st Qu.:2011   Class :character   1st Qu.:76.33    
##  Mode  :character   Median :2012   Mode  :character   Median :81.10    
##                     Mean   :2012                      Mean   :80.23    
##                     3rd Qu.:2014                      3rd Qu.:82.78    
##                     Max.   :2015                      Max.   :89.00    
##  Mortalidad.adulta Porcentaje.gastos       IDH              PIB       
##  Min.   :  6.00    Min.   :    0.00   Min.   :0.7700   Min.   :72.40  
##  1st Qu.: 58.00    1st Qu.:   49.99   1st Qu.:0.8273   1st Qu.:76.33  
##  Median : 76.00    Median :  758.91   Median :0.8600   Median :81.10  
##  Mean   : 82.35    Mean   : 2196.88   Mean   :0.8586   Mean   :80.23  
##  3rd Qu.:116.25    3rd Qu.: 2655.76   3rd Qu.:0.8888   3rd Qu.:82.78  
##  Max.   :188.00    Max.   :17028.53   Max.   :0.9260   Max.   :89.00  
##       IMC          Total.kcal    Vegetal.kcal   Animal.kcal    
##  Min.   : 6.00   Min.   :2640   Min.   :1907   Min.   : 632.0  
##  1st Qu.:57.62   1st Qu.:3166   1st Qu.:2172   1st Qu.: 825.2  
##  Median :59.70   Median :3368   Median :2362   Median : 938.0  
##  Mean   :53.07   Mean   :3311   Mean   :2350   Mean   : 960.3  
##  3rd Qu.:62.58   3rd Qu.:3486   3rd Qu.:2515   3rd Qu.:1090.8  
##  Max.   :69.60   Max.   :3804   Max.   :2677   Max.   :1427.0  
##    GrasasAnim        Verduras      Fruits..other       Azucar     
##  Min.   :  2.87   Min.   : 26.72   Min.   :11.91   Min.   :141.5  
##  1st Qu.: 43.91   1st Qu.: 49.82   1st Qu.:26.61   1st Qu.:239.7  
##  Median : 96.94   Median : 58.20   Median :31.11   Median :295.9  
##  Mean   :108.02   Mean   : 60.88   Mean   :33.09   Mean   :309.4  
##  3rd Qu.:139.24   3rd Qu.: 67.89   3rd Qu.:40.69   3rd Qu.:377.5  
##  Max.   :288.65   Max.   :109.73   Max.   :61.61   Max.   :543.9  
##     Cereales     
##  Min.   : 0.000  
##  1st Qu.: 2.708  
##  Median : 7.240  
##  Mean   :10.275  
##  3rd Qu.:12.318  
##  Max.   :76.510

To facilitate the analysis, derived variables were created that synthesise the energy composition of the diet, such as the percentage of calories from animal and plant sources, the ratio between the two and an index of dietary diversity.

# Comparo PIB e IMC por estatus de desarrollo
obj1 <- obj1 %>%
  mutate(
    Pct_Animal = 100 * Animal.kcal / Total.kcal,
    Pct_Vegetal = 100 * Vegetal.kcal / Total.kcal,
    Ratio_A_V = Animal.kcal / Vegetal.kcal,
    Umbral = 0.05 * Total.kcal,
    Diversidad_Alim = (Vegetal.kcal > Umbral) + (Animal.kcal > Umbral) + (GrasasAnim > Umbral) + 
                      (Verduras > Umbral) + (`Fruits..other` > Umbral) + (Azucar > Umbral) + (Cereales > Umbral)
  ) %>%
  select(-Umbral)

head(obj1)
##      Pais  Año   Estatus Esperanza.de.vida Mortalidad.adulta Porcentaje.gastos
## 1 Austria 2010 Developed              84.0                75        7423.22877
## 2 Austria 2011 Developed              88.0                73        8272.30676
## 3 Austria 2012 Developed              88.0                 7        7878.37236
## 4 Austria 2013 Developed              81.1                68          90.58501
## 5 Austria 2014 Developed              81.4                66        8350.19352
## 6 Austria 2015 Developed              81.5                65           0.00000
##     IDH  PIB  IMC Total.kcal Vegetal.kcal Animal.kcal GrasasAnim Verduras
## 1 0.872 84.0 55.2       3724         2621        1103     263.23    56.33
## 2 0.880 88.0 55.7       3735         2632        1104     258.55    59.17
## 3 0.884 88.0 56.1       3739         2631        1108     281.08    58.56
## 4 0.887 81.1 56.6       3768         2631        1137     268.56    56.81
## 5 0.892 81.4 57.1       3672         2539        1133     232.54    57.40
## 6 0.892 81.5 57.6       3664         2503        1161     242.55    50.91
##   Fruits..other Azucar Cereales Pct_Animal Pct_Vegetal Ratio_A_V
## 1         40.49 418.97    15.09   29.61869    70.38131 0.4208317
## 2         43.29 422.66    23.18   29.55823    70.46854 0.4194529
## 3         40.20 416.84    27.02   29.63359    70.36641 0.4211326
## 4         43.12 401.71    18.95   30.17516    69.82484 0.4321551
## 5         38.82 404.49    18.34   30.85512    69.14488 0.4462387
## 6         41.45 424.03    11.49   31.68668    68.31332 0.4638434
##   Diversidad_Alim
## 1               4
## 2               4
## 3               4
## 4               4
## 5               4
## 6               4
summary(obj1)
##      Pais                Año         Estatus          Esperanza.de.vida
##  Length:150         Min.   :2010   Length:150         Min.   :72.40    
##  Class :character   1st Qu.:2011   Class :character   1st Qu.:76.33    
##  Mode  :character   Median :2012   Mode  :character   Median :81.10    
##                     Mean   :2012                      Mean   :80.23    
##                     3rd Qu.:2014                      3rd Qu.:82.78    
##                     Max.   :2015                      Max.   :89.00    
##  Mortalidad.adulta Porcentaje.gastos       IDH              PIB       
##  Min.   :  6.00    Min.   :    0.00   Min.   :0.7700   Min.   :72.40  
##  1st Qu.: 58.00    1st Qu.:   49.99   1st Qu.:0.8273   1st Qu.:76.33  
##  Median : 76.00    Median :  758.91   Median :0.8600   Median :81.10  
##  Mean   : 82.35    Mean   : 2196.88   Mean   :0.8586   Mean   :80.23  
##  3rd Qu.:116.25    3rd Qu.: 2655.76   3rd Qu.:0.8888   3rd Qu.:82.78  
##  Max.   :188.00    Max.   :17028.53   Max.   :0.9260   Max.   :89.00  
##       IMC          Total.kcal    Vegetal.kcal   Animal.kcal    
##  Min.   : 6.00   Min.   :2640   Min.   :1907   Min.   : 632.0  
##  1st Qu.:57.62   1st Qu.:3166   1st Qu.:2172   1st Qu.: 825.2  
##  Median :59.70   Median :3368   Median :2362   Median : 938.0  
##  Mean   :53.07   Mean   :3311   Mean   :2350   Mean   : 960.3  
##  3rd Qu.:62.58   3rd Qu.:3486   3rd Qu.:2515   3rd Qu.:1090.8  
##  Max.   :69.60   Max.   :3804   Max.   :2677   Max.   :1427.0  
##    GrasasAnim        Verduras      Fruits..other       Azucar     
##  Min.   :  2.87   Min.   : 26.72   Min.   :11.91   Min.   :141.5  
##  1st Qu.: 43.91   1st Qu.: 49.82   1st Qu.:26.61   1st Qu.:239.7  
##  Median : 96.94   Median : 58.20   Median :31.11   Median :295.9  
##  Mean   :108.02   Mean   : 60.88   Mean   :33.09   Mean   :309.4  
##  3rd Qu.:139.24   3rd Qu.: 67.89   3rd Qu.:40.69   3rd Qu.:377.5  
##  Max.   :288.65   Max.   :109.73   Max.   :61.61   Max.   :543.9  
##     Cereales        Pct_Animal     Pct_Vegetal      Ratio_A_V     
##  Min.   : 0.000   Min.   :22.68   Min.   :57.22   Min.   :0.2935  
##  1st Qu.: 2.708   1st Qu.:25.99   1st Qu.:69.00   1st Qu.:0.3512  
##  Median : 7.240   Median :28.48   Median :71.50   Median :0.3983  
##  Mean   :10.275   Mean   :28.92   Mean   :71.08   Mean   :0.4116  
##  3rd Qu.:12.318   3rd Qu.:31.00   3rd Qu.:74.01   3rd Qu.:0.4494  
##  Max.   :76.510   Max.   :42.81   Max.   :77.29   Max.   :0.7483  
##  Diversidad_Alim
##  Min.   :2.000  
##  1st Qu.:3.000  
##  Median :3.000  
##  Mean   :3.133  
##  3rd Qu.:3.000  
##  Max.   :4.000
resumen <- obj1 %>%
  group_by(Estatus) %>%
  summarise(
    Media_Pct_Animal = mean(Pct_Animal, na.rm = TRUE),
    Mediana_Pct_Animal = median(Pct_Animal, na.rm = TRUE),
    SD_Pct_Animal = sd(Pct_Animal, na.rm = TRUE),
    
    Media_Pct_Vegetal = mean(Pct_Vegetal, na.rm = TRUE),
    Mediana_Pct_Vegetal = median(Pct_Vegetal, na.rm = TRUE),
    SD_Pct_Vegetal = sd(Pct_Vegetal, na.rm = TRUE),
    
    Media_Ratio_A_V = mean(Ratio_A_V, na.rm = TRUE),
    Mediana_Ratio_A_V = median(Ratio_A_V, na.rm = TRUE),
    SD_Ratio_A_V = sd(Ratio_A_V, na.rm = TRUE),
    
    Media_Diversidad = mean(Diversidad_Alim, na.rm = TRUE),
    Mediana_Diversidad = median(Diversidad_Alim, na.rm = TRUE),
    SD_Diversidad = sd(Diversidad_Alim, na.rm = TRUE)
  )

print(resumen)
## # A tibble: 2 × 13
##   Estatus    Media_Pct_Animal Mediana_Pct_Animal SD_Pct_Animal Media_Pct_Vegetal
##   <chr>                 <dbl>              <dbl>         <dbl>             <dbl>
## 1 Developed              28.5               28.2          3.24              71.5
## 2 Developing             30.9               31.7          6.47              69.1
## # ℹ 8 more variables: Mediana_Pct_Vegetal <dbl>, SD_Pct_Vegetal <dbl>,
## #   Media_Ratio_A_V <dbl>, Mediana_Ratio_A_V <dbl>, SD_Ratio_A_V <dbl>,
## #   Media_Diversidad <dbl>, Mediana_Diversidad <dbl>, SD_Diversidad <dbl>
summary(resumen)
##    Estatus          Media_Pct_Animal Mediana_Pct_Animal SD_Pct_Animal  
##  Length:2           Min.   :28.54    Min.   :28.23      Min.   :3.240  
##  Class :character   1st Qu.:29.14    1st Qu.:29.10      1st Qu.:4.047  
##  Mode  :character   Median :29.74    Median :29.97      Median :4.854  
##                     Mean   :29.74    Mean   :29.97      Mean   :4.854  
##                     3rd Qu.:30.34    3rd Qu.:30.84      3rd Qu.:5.661  
##                     Max.   :30.94    Max.   :31.71      Max.   :6.468  
##  Media_Pct_Vegetal Mediana_Pct_Vegetal SD_Pct_Vegetal  Media_Ratio_A_V 
##  Min.   :69.07     Min.   :68.29       Min.   :3.241   Min.   :0.4023  
##  1st Qu.:69.66     1st Qu.:69.16       1st Qu.:4.047   1st Qu.:0.4169  
##  Median :70.26     Median :70.03       Median :4.853   Median :0.4315  
##  Mean   :70.26     Mean   :70.03       Mean   :4.853   Mean   :0.4315  
##  3rd Qu.:70.86     3rd Qu.:70.90       3rd Qu.:5.660   3rd Qu.:0.4460  
##  Max.   :71.46     Max.   :71.77       Max.   :6.466   Max.   :0.4606  
##  Mediana_Ratio_A_V  SD_Ratio_A_V     Media_Diversidad Mediana_Diversidad
##  Min.   :0.3933    Min.   :0.06532   Min.   :3.000    Min.   :3         
##  1st Qu.:0.4111    1st Qu.:0.08448   1st Qu.:3.040    1st Qu.:3         
##  Median :0.4288    Median :0.10364   Median :3.079    Median :3         
##  Mean   :0.4288    Mean   :0.10364   Mean   :3.079    Mean   :3         
##  3rd Qu.:0.4466    3rd Qu.:0.12281   3rd Qu.:3.119    3rd Qu.:3         
##  Max.   :0.4643    Max.   :0.14197   Max.   :3.159    Max.   :3         
##  SD_Diversidad   
##  Min.   :0.0000  
##  1st Qu.:0.1201  
##  Median :0.2401  
##  Mean   :0.2401  
##  3rd Qu.:0.3602  
##  Max.   :0.4802

To analyse the differences in dietary habits according to the level of development, comparisons of the derived variables were made between countries categorised as developed and developing. The boxplots clearly showed that developing countries tend to have a higher percentage of calories from animal sources and sugar, while developed countries have a higher percentage of vegetable calories and animal fats. This disparity reflects distinctive dietary patterns linked to economic and cultural factors. In addition, the bar chart breaking down average calorie intake by food type and economic status highlighted these differences quantitatively, facilitating the identification of clear trends that could guide specific nutritional policies for each group.

# Gráfico de barras: consumo calórico por tipo de alimento y estatus de desarrollo
df_long <- obj1 %>%
  select(Estatus, Vegetal.kcal, Animal.kcal, Azucar, GrasasAnim, Verduras) %>%
  group_by(Estatus) %>%
  summarise(across(where(is.numeric), mean, na.rm = TRUE)) %>%
  pivot_longer(cols = -Estatus, names_to = "Grupo", values_to = "kcal")
## Warning: There was 1 warning in `summarise()`.
## ℹ In argument: `across(where(is.numeric), mean, na.rm = TRUE)`.
## ℹ In group 1: `Estatus = "Developed"`.
## Caused by warning:
## ! The `...` argument of `across()` is deprecated as of dplyr 1.1.0.
## Supply arguments directly to `.fns` through an anonymous function instead.
## 
##   # Previously
##   across(a:b, mean, na.rm = TRUE)
## 
##   # Now
##   across(a:b, \(x) mean(x, na.rm = TRUE))
ggplot(df_long, aes(x = Grupo, y = kcal, fill = Estatus)) +
  geom_col(position = "dodge") +
  labs(title = "Consumo promedio por grupo alimenticio según nivel de desarrollo", x = "Grupo alimenticio", y = "kcal promedio") +
  theme_minimal() +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))

# Boxplot % kcal animal
p1 <-ggplot(obj1, aes(x = Estatus, y = Pct_Animal, fill = Estatus)) +
  geom_boxplot() +
  labs(
       x = "Nivel de desarrollo económico",
       y = "% kcal de origen animal") +
  theme_minimal() +
  theme(legend.position = "none")

# Boxplot % kcal vegetal
p2 <-ggplot(obj1, aes(x = Estatus, y = Pct_Vegetal, fill = Estatus)) +
  geom_boxplot() +
  labs(
       x = "Nivel de desarrollo económico",
       y = "% kcal de origen vegetal") +
  theme_minimal() +
  theme(legend.position = "none")


# Boxplot Ratio Animal / Vegetal
p3 <-ggplot(obj1, aes(x = Estatus, y = Ratio_A_V, fill = Estatus)) +
  geom_boxplot() +
  labs(
       x = "Nivel de desarrollo económico",
       y = "Ratio kcal animal / vegetal") +
  theme_minimal() +
  theme(legend.position = "none")
grid.arrange(p1, p2, p3, nrow = 1)

Analysis of the temporal evolution of diet provided insights into how dietary habits have changed between 2010 and 2015. It was observed that the proportion of animal calories has shown a moderate increase in both groups, with a more pronounced increase in developing countries. This finding suggests that the nutrition transition, with increased consumption of animal products, is more active in developing countries, possibly due to economic improvements or changes in cultural preferences. These temporal trends are essential to anticipate future public health challenges and to adjust appropriate intervention strategies.

obj1 %>%
  group_by(Año) %>%
  summarise(esperanza_media = mean(Esperanza.de.vida, na.rm = TRUE)) %>%
  ggplot(aes(x = Año, y = esperanza_media)) +
  geom_line(color = "blue") +
  labs(title = "Evolución de la Esperanza de Vida Promedio", y = "Esperanza de Vida", x = "Año") +
  theme_minimal()

wilcox.test(Pct_Animal ~ Estatus, data = obj1)
## 
##  Wilcoxon rank sum test with continuity correction
## 
## data:  Pct_Animal by Estatus
## W = 1297, p-value = 0.2715
## alternative hypothesis: true location shift is not equal to 0

To quantify the influence of economic and health variables on dietary habits, linear regression models were fitted. In these models, the percentage of animal calories and dietary diversity were considered as dependent variables, while the Human Development Index, Gross Domestic Product per capita, body mass index and year were included as predictors. The results showed that HDI and GDP are significant variables that explain important variations in diet, confirming their relevance as determinants of dietary behaviour at the population level. In addition, the inclusion of BMI allowed controlling for possible influences related to the health status of the population, enriching the interpretation of the models.

g1 <-ggscatter(obj1, x = "IDH", y = "Pct_Animal",
          add = "reg.line", conf.int = TRUE,
          cor.coef = TRUE, cor.method = "pearson",
          xlab = "IDH", ylab = "% kcal animal",
          title = "Relación entre IDH y % kcal animal")



g2 <-ggscatter(obj1, x = "IDH", y = "Pct_Vegetal",
          add = "reg.line", conf.int = TRUE,
          cor.coef = TRUE, cor.method = "pearson",
          xlab = "IDH", ylab = "% kcal vegetal",
          title = "Relación entre IDH y % kcal vegetal")


obj1 <- obj1 %>% mutate(log_PIB = log(PIB + 1))  # Añadimos 1 para evitar log(0)

g3 <-ggscatter(obj1, x = "log_PIB", y = "Pct_Animal",
          add = "reg.line", conf.int = TRUE,
          cor.coef = TRUE, cor.method = "pearson",
          xlab = "Log(PIB)", ylab = "% kcal animal",
          title = "Relación entre log(PIB) y % kcal animal")
grid.arrange(g1,g2,g3, nrow = 1)

modelo1 <- lm(Pct_Animal ~ IDH + Año, data = obj1)
summary(modelo1)
## 
## Call:
## lm(formula = Pct_Animal ~ IDH + Año, data = obj1)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -6.2082 -2.5066 -0.2937  2.2880 12.0830 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 122.19201  329.12276   0.371    0.711    
## IDH          57.75426    7.42021   7.783 1.16e-12 ***
## Año          -0.07099    0.16400  -0.433    0.666    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 3.388 on 147 degrees of freedom
## Multiple R-squared:  0.294,  Adjusted R-squared:  0.2844 
## F-statistic: 30.61 on 2 and 147 DF,  p-value: 7.722e-12
modelo2 <- lm(Diversidad_Alim ~ log_PIB + IMC + Año, data = obj1)
summary(modelo2)
## 
## Call:
## lm(formula = Diversidad_Alim ~ log_PIB + IMC + Año, data = obj1)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -1.13261 -0.19418 -0.14910  0.08001  0.92684 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)   
## (Intercept) 30.128168  41.875079   0.719  0.47300   
## log_PIB     -0.881454   0.662975  -1.330  0.18574   
## IMC          0.005214   0.001818   2.867  0.00475 **
## Año         -0.011626   0.020913  -0.556  0.57913   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.4333 on 146 degrees of freedom
## Multiple R-squared:  0.06565,    Adjusted R-squared:  0.04645 
## F-statistic: 3.419 on 3 and 146 DF,  p-value: 0.01902

Principal Component Analysis was used to reduce the complexity of the set of derived food variables, allowing the identification of the underlying factors that best explain the variability in dietary habits across countries. Through this technique, it was possible to visualise how countries are distributed in a reduced space of components, where the first components accumulate most of the relevant information. The clear differentiation between developed and developing countries observed in the biplot graphs confirms that the selected variables capture substantial differences in dietary patterns, facilitating a simpler and more robust interpretation of the existing relationships.

alim_vars <- obj1 %>%
  select(Pct_Animal, Pct_Vegetal, Ratio_A_V, Diversidad_Alim) %>%
  na.omit()

pca <- PCA(alim_vars, scale.unit = TRUE, graph = FALSE)

fviz_pca_biplot(pca, repel = TRUE)

obj1_clean <- obj1 %>%
  filter(!is.na(Pct_Animal), !is.na(Pct_Vegetal), !is.na(Ratio_A_V), !is.na(Diversidad_Alim), !is.na(Estatus))
estatus_pca <- factor(obj1_clean$Estatus)
fviz_pca_ind(pca,
             geom.ind = "point",
             habillage = estatus_pca,
             addEllipses = TRUE,
             palette = "jco",
             legend.title = "Nivel de desarrollo")

obj1 %>%
  group_by(Año, Estatus) %>%
  summarise(Media_Pct_Animal = mean(Pct_Animal, na.rm = TRUE), .groups = "drop") %>%
  ggplot(aes(x = Año, y = Media_Pct_Animal, color = Estatus)) +
  geom_line(linewidth  = 1) +
  labs(title = "% kcal animal promedio anual por nivel de desarrollo",
       y = "% kcal animal", x = "Año") +
  theme_minimal()

It was used to group countries according to the similarity of their dietary profiles, based on previously standardised derived variables. Ward’s method, recognised for its effectiveness in minimising the internal variance of the groups, allowed the construction of a dendrogram reflecting the hierarchical structure of the clusters. Natural clusters within the sample were identified as showing high internal cohesion, and comparison with the classification according to the level of economic development revealed a strong correspondence. This technique provided a complementary and visual insight that reinforces the hypothesis that economic development influences eating habits in a consistent and structured way.

# Uso las variables derivadas normalizadas
alim_norm <- scale(obj1_clean %>% 
                     select(Pct_Animal, Pct_Vegetal, Ratio_A_V, Diversidad_Alim))

# Calculo distancia y agrupación jerárquica
distancia <- dist(alim_norm)
p1 <- fviz_nbclust(alim_norm, hcut, method = "silhouette", 
                  hc_method = "ward.D2", k.max = 10) + labs(title = "Número óptimo de clusters (Silhouette)")
p2 <- fviz_nbclust(alim_norm, hcut, method = "wss", 
                  hc_method = "ward.D2", k.max = 10) + labs(title = "Número óptimo de clusters (Codo)")

grid.arrange(p1, p2, nrow = 1)

# Según criterio, selecciono número de clusters 3
num_clusters <- 3

# Clustering jerárquico con método Ward
clust <- hclust(distancia, method = "ward.D2")

# Corto dendrograma en num_clusters grupos
grupos <- cutree(clust, k = num_clusters)

# Añado clusters a datos originales
obj1_clean$Cluster <- factor(grupos)
# Visualizo dendrograma con clusters coloreados y rectángulos
fviz_dend(clust, k = num_clusters, 
          cex = 0.6, # tamaño texto etiquetas
          color_labels_by_k = TRUE,
          rect = TRUE, rect_border = "jco", rect_fill = TRUE,
          show_labels = FALSE,
          main = "Dendrograma de patrones alimentarios")
## Warning: The `<scale>` argument of `guides()` cannot be `FALSE`. Use "none" instead as
## of ggplot2 3.3.4.
## ℹ The deprecated feature was likely used in the factoextra package.
##   Please report the issue at <https://github.com/kassambara/factoextra/issues>.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.

# Comparo clusters con Estatus
table(obj1_clean$Cluster, obj1_clean$Estatus)
##    
##     Developed Developing
##   1        24          0
##   2        84         12
##   3        18         12

It provided an essential tool for examining bivariate relationships between economic and diet-derived variables. Using scatter plots with fitted regression lines and correlation matrices, statistically significant associations were identified that corroborate and complement previous findings. This graphical and numerical analysis provided clarity on the strength and direction of the relationships, helping to validate the hypotheses put forward and reinforce the final conclusions of the study.

anova_animal <- aov(Pct_Animal ~ Estatus, data = obj1_clean)
summary(anova_animal)
##              Df Sum Sq Mean Sq F value Pr(>F)   
## Estatus       1  115.8  115.80   7.535 0.0068 **
## Residuals   148 2274.4   15.37                  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
anova_diversidad <- aov(Diversidad_Alim ~ Estatus, data = obj1_clean)
summary(anova_diversidad)
##              Df Sum Sq Mean Sq F value Pr(>F)
## Estatus       1  0.508  0.5079   2.608  0.108
## Residuals   148 28.825  0.1948
modelo_multi <- lm(Pct_Animal ~ IDH + PIB + IMC + Año, data = obj1_clean)
summary(modelo_multi)
## 
## Call:
## lm(formula = Pct_Animal ~ IDH + PIB + IMC + Año, data = obj1_clean)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -6.062 -2.529 -0.091  2.056 11.885 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  71.79256  322.08123   0.223   0.8239    
## IDH          73.88916    9.94247   7.432 8.53e-12 ***
## PIB          -0.20806    0.08563  -2.430   0.0163 *  
## IMC          -0.02702    0.01386  -1.949   0.0532 .  
## Año          -0.04382    0.16053  -0.273   0.7853    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 3.302 on 145 degrees of freedom
## Multiple R-squared:  0.3387, Adjusted R-squared:  0.3204 
## F-statistic: 18.56 on 4 and 145 DF,  p-value: 2.444e-12
pairs(obj1_clean %>%
         select(Pct_Animal, Pct_Vegetal, Ratio_A_V, Diversidad_Alim, IDH, PIB, IMC),
       main = "Matriz de correlaciones (visual)")

##Conclusions

This study has clearly and rigorously demonstrated how the level of economic development of countries profoundly influences the dietary habits of their citizens. Through a comprehensive analysis combining socio-economic variables, health and detailed dietary measures, it has shown that differences in dietary composition and diversity are closely linked to the economic context.

Derived variables capturing the percentage of calories from animal and plant sources, as well as an index of dietary diversity, revealed differential dietary patterns: developing countries tend to consume a higher proportion of calories from animal foods and sugars, while developed countries have diets with a higher intake of plant calories and animal fats, reflecting deep cultural and economic influences.

The combined use of multivariate techniques such as Principal Component Analysis and hierarchical clustering allowed not only to reduce the complexity of the data but also to identify natural groupings of countries with homogeneous dietary profiles, strongly aligned with their level of development. This finding provides strong and visual support for the central hypothesis of the study.

The fitted regression models confirmed the crucial role of the Human Development Index and Gross Domestic Product per capita as significant predictors of dietary patterns, evidencing the interaction between economic well-being and dietary choices. In addition, the incorporation of body mass index as a control variable enriched the understanding of the phenomenon from a multidimensional perspective.

Overall, this work provides relevant empirical evidence for policy makers, nutritionists and economists, highlighting the need to address dietary habits from a comprehensive approach that considers the socio-economic context. The clear differentiation and dynamics detected between countries suggest that strategies to improve nutrition should be adapted to specific economic conditions, with special attention to the nutrition transition in developing countries.

Finally, this research opens the door to future lines of study, including deeper longitudinal analyses, incorporation of cultural and regional factors, and exploration of interventions that promote healthier and more sustainable diets as a function of economic development. Undoubtedly, this report represents a significant contribution to the field of socio-economic analysis of food and lays the foundation for future research that will contribute to improving global health through informed and contextualised policies.