library(RNHANES)
nhanes.food <- nhanes_load_data("FSQ", "2013-2014", demographics = TRUE)
## Downloading FSQ_H.XPT to C:\Users\rachz\AppData\Local\Temp\RtmpiKS2G5/FSQ_H.XPT
## Downloading DEMO_H.XPT to C:\Users\rachz\AppData\Local\Temp\RtmpiKS2G5/DEMO_H.XPT
## Caching CSV to C:\Users\rachz\AppData\Local\Temp\RtmpiKS2G5/DEMO_H.csv
https://wwwn.cdc.gov/Nchs/Nhanes/2013-2014/FSQ_H.htm#Codebook
https://wwwn.cdc.gov/Nchs/Nhanes/2013-2014/DEMO_H.htm#Codebook
How do the demographic factors of age, race,education level, and the number of people in a household impact an adult’s food security status?
To determine how the demographic factors of age, race, education level, and the number of people in a household impact an adult’s food security status.
Adult food security category (FSDAD)
Age (RIDAGEYR)
Race (RIDRETH3)
Education level (DMDEDUC2)
Total number of persons in a household (DMDHHSIZ)
This data was collected by NHANES in 2013-2014 through personal interviews on household food security; Supplemental Nutrition Assistance Program (SNAP)/Food Stamps benefits; Women, Infant, and Children (WIC) benefits by the National Health and Nutrition Examination Survey (NHANES).
This data contains 10,175 observations and 90 variables.
Data type: factor/categorical
1 AD full food security: 0……………6725
2 AD marginal food security: 1-2………1242
3 AD low food security: 3-5…………..1269
4 AD very low food security: 6-10………817
. Missing……………………………122
Data type: numeric/continuous
0 to 79 Range of Values……..9823
80 80 years of age and over…..352
. Missing…………………….0
Data type: factor/categorical
1 Mexican American………………….1730
2 Other Hispanic…………………….960
3 Non-Hispanic White………………..3674
4 Non-Hispanic Black………………..2267
6 Non-Hispanic Asian………………..1074
7 Other Race - Including Multi-Racial….470
. Missing…………………………….0
Data type: factor/categorical
1 Less than 9th grade……………………………455
2 9-11th grade (Includes 12th grade with no diploma)..791
3 High school graduate/GED or equivalent………….1303
4 Some college or AA degree……………………..1770
5 College graduate or above……………………..1443
7 Refused………………………………………..2
9 Don’t Know……………………………………..5
. Missing……………………………………..4406
Data type: factor/categorical
1 1………………………………………817
2 2……………………………………..1787
3 3……………………………………..1779
4 4……………………………………..2100
5 5………………………………………781
6 6………………………………………985
7 7 or more people in the Household………….926
. Missing…………………………………..0
# Load packages
library('tidyverse')
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.2 ──
## ✔ ggplot2 3.3.6 ✔ purrr 0.3.4
## ✔ tibble 3.1.8 ✔ dplyr 1.0.9
## ✔ tidyr 1.2.0 ✔ stringr 1.4.1
## ✔ readr 2.1.2 ✔ forcats 0.5.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
library(ggplot2)
library("viridis")
## Loading required package: viridisLite
library(table1)
##
## Attaching package: 'table1'
##
## The following objects are masked from 'package:base':
##
## units, units<-
library(descr)
nhanes.food.cleaned<-nhanes.food %>%
select(FSDAD,RIDAGEYR,RIDRETH3,DMDEDUC2,DMDHHSIZ)%>%
mutate(FSDAD = recode_factor(.x =FSDAD,
'1' = 'adult full food security',
'2' = 'adult marginal food security',
'3' = 'adult low food security',
'4' = 'adult very low food security',
.missing = NA_character_)) %>%
mutate(RIDAGEYR = na_if(RIDAGEYR, '.')) %>%
mutate(RIDRETH3 = recode_factor(.x = RIDRETH3,
'1' = 'Mexican American',
'2' = 'Other Hispanic',
'3' = 'Non-Hispanic White',
'4' = 'Non-Hispanic Black',
'6' = 'Non-Hispanic Asian',
'7' = 'Other Race - Including Multi-Racial',
.missing = NA_character_))%>%
mutate(DMDEDUC2 = recode_factor(.x = DMDEDUC2,
'1' = 'Less than 9th grade',
'2' = '9-11th grade',
'3' = 'High school graduate/GED or equivalent',
'4' = 'Some college or AA degree',
'5' = 'College graduate or above',
"7" = NA_character_,
"9" = NA_character_,
.missing = NA_character_)) %>%
mutate(DMDHHSIZ = recode_factor(.x = DMDHHSIZ,
'1' = '1 person',
'2' = '2 persons',
'3' = '3 persons',
'4' = '4 persons',
'5' = '5 persons',
'6' = '6 persons',
'7' = '7 or more persons',
.missing = NA_character_))%>%
rename(food.security = FSDAD,
age = RIDAGEYR,
race = RIDRETH3,
education.level = DMDEDUC2,
household = DMDHHSIZ)%>%
drop_na()
summary(nhanes.food.cleaned)
## food.security age
## adult full food security :4040 Min. :20.00
## adult marginal food security: 588 1st Qu.:34.00
## adult low food security : 624 Median :48.00
## adult very low food security: 433 Mean :49.18
## 3rd Qu.:63.00
## Max. :80.00
##
## race
## Mexican American : 753
## Other Hispanic : 499
## Non-Hispanic White :2440
## Non-Hispanic Black :1164
## Non-Hispanic Asian : 653
## Other Race - Including Multi-Racial: 176
##
## education.level household
## Less than 9th grade : 449 1 person : 800
## 9-11th grade : 774 2 persons :1588
## High school graduate/GED or equivalent:1291 3 persons :1041
## Some college or AA degree :1745 4 persons : 931
## College graduate or above :1426 5 persons : 661
## 6 persons : 319
## 7 or more persons: 345
bar.food.security <- nhanes.food.cleaned %>%
ggplot(aes(x = food.security, fill = food.security, y = 100*(..count..)/sum(..count..)))+
geom_bar(aes(fill = food.security), show.legend = FALSE)+
labs(x = "Degree of food security",
y = "Percent or participants",
subtitle = "Adult Food Security - NHANES 2013-2014")+
scale_color_brewer(palette = "Set2")+
coord_flip()+
theme_minimal()
print(bar.food.security)
hist.age <- nhanes.food.cleaned %>%
ggplot(aes(x=age))+
geom_histogram(fill = "darkseagreen", color = "black")+
labs(x = "Age in years",
y = "Number of responses")+
theme_minimal()
print(hist.age)
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
median(nhanes.food.cleaned$age)
## [1] 48
bar.race <- nhanes.food.cleaned %>%
ggplot(aes(x = race, fill = race, y = 100*(..count..)/sum(..count..)))+
geom_bar(aes(fill = race), show.legend = FALSE)+
labs(x = "Race/Ethnicity",
y = "Percent",
subtitle = "Race/Ethnicity - NHANES 2013-2014")+
scale_color_brewer(palette = "Set2")+
coord_flip()+
theme_minimal()
print(bar.race)
bar.education.level <- nhanes.food.cleaned %>%
ggplot(aes(x = education.level, fill = education.level, y = 100*(..count..)/sum(..count..)))+
geom_bar(aes(fill = education.level), show.legend = FALSE)+
labs(x = "Level of Education",
y = "Percent",
subtitle = "Education Level - NHANES 2013-2014")+
scale_color_brewer(palette = "Set2")+
coord_flip()+
theme_minimal()
print(bar.education.level)
bar.household <- nhanes.food.cleaned %>%
ggplot(aes(x = household, fill = household, y = 100*(..count..)/sum(..count..)))+
geom_bar(aes(fill = household), show.legend = FALSE)+
labs(x = "Number of persons in household",
y = "Percent",
subtitle = "Number in Household - NHANES 2013-2014")+
scale_color_brewer(palette = "Set2")+
coord_flip()+
theme_minimal()
print(bar.household)
Most of respondents had full food security (71%). The median age of respondents was 48 years of age. Most respondents were non-Hispanic White (43%) and non-Hispanic Black (20%). Most respondents had some college education or an associates degree (31%) or were a college graduate (25%). Most of the surveyed population had 2 persons within their household (28%).
label(nhanes.food.cleaned$age) <- "Median Age of Respondents (IQR)"
label(nhanes.food.cleaned$race) <- "Race of Respondents"
label(nhanes.food.cleaned$education.level) <- "Education Level of Respondents"
label(nhanes.food.cleaned$household) <- "Number of Persons in Respondent Household"
table1(~ age + race + education.level + household | food.security,
render.continuous = "Median (IQR)",
data = nhanes.food.cleaned)
| adult full food security (N=4040) |
adult marginal food security (N=588) |
adult low food security (N=624) |
adult very low food security (N=433) |
Overall (N=5685) |
|
|---|---|---|---|---|---|
| Median Age of Respondents (IQR) | 51.0 (29.0) | 43.0 (28.0) | 44.0 (26.0) | 42.0 (26.0) | 48.0 (29.0) |
| Race of Respondents | |||||
| Mexican American | 432 (10.7%) | 99 (16.8%) | 150 (24.0%) | 72 (16.6%) | 753 (13.2%) |
| Other Hispanic | 301 (7.5%) | 67 (11.4%) | 95 (15.2%) | 36 (8.3%) | 499 (8.8%) |
| Non-Hispanic White | 1856 (45.9%) | 200 (34.0%) | 191 (30.6%) | 193 (44.6%) | 2440 (42.9%) |
| Non-Hispanic Black | 761 (18.8%) | 164 (27.9%) | 141 (22.6%) | 98 (22.6%) | 1164 (20.5%) |
| Non-Hispanic Asian | 580 (14.4%) | 39 (6.6%) | 27 (4.3%) | 7 (1.6%) | 653 (11.5%) |
| Other Race - Including Multi-Racial | 110 (2.7%) | 19 (3.2%) | 20 (3.2%) | 27 (6.2%) | 176 (3.1%) |
| Education Level of Respondents | |||||
| Less than 9th grade | 237 (5.9%) | 71 (12.1%) | 92 (14.7%) | 49 (11.3%) | 449 (7.9%) |
| 9-11th grade | 446 (11.0%) | 95 (16.2%) | 151 (24.2%) | 82 (18.9%) | 774 (13.6%) |
| High school graduate/GED or equivalent | 847 (21.0%) | 163 (27.7%) | 162 (26.0%) | 119 (27.5%) | 1291 (22.7%) |
| Some college or AA degree | 1220 (30.2%) | 201 (34.2%) | 166 (26.6%) | 158 (36.5%) | 1745 (30.7%) |
| College graduate or above | 1290 (31.9%) | 58 (9.9%) | 53 (8.5%) | 25 (5.8%) | 1426 (25.1%) |
| Number of Persons in Respondent Household | |||||
| 1 person | 602 (14.9%) | 67 (11.4%) | 49 (7.9%) | 82 (18.9%) | 800 (14.1%) |
| 2 persons | 1253 (31.0%) | 98 (16.7%) | 130 (20.8%) | 107 (24.7%) | 1588 (27.9%) |
| 3 persons | 755 (18.7%) | 107 (18.2%) | 115 (18.4%) | 64 (14.8%) | 1041 (18.3%) |
| 4 persons | 677 (16.8%) | 110 (18.7%) | 105 (16.8%) | 39 (9.0%) | 931 (16.4%) |
| 5 persons | 399 (9.9%) | 104 (17.7%) | 103 (16.5%) | 55 (12.7%) | 661 (11.6%) |
| 6 persons | 180 (4.5%) | 40 (6.8%) | 57 (9.1%) | 42 (9.7%) | 319 (5.6%) |
| 7 or more persons | 174 (4.3%) | 62 (10.5%) | 65 (10.4%) | 44 (10.2%) | 345 (6.1%) |
box.food.security.age <- nhanes.food.cleaned %>%
ggplot(aes(x = age, y = food.security))+
geom_jitter(aes(color = age), alpha = .6)+
geom_boxplot(aes(fill = age), alpha = .4)+
theme_minimal()+
labs (x = "Median age of participants (in years)", y = "Degree of food security", subtitle = "Food Security and Age")+
scale_fill_viridis(palette = "magma")
print(box.food.security.age)
The median age of respondents who reported full food security (51) was greater than that of respondents who reported marginal food security (43), low food security (44), and very low food security (42).
bar.food.security.race <- nhanes.food.cleaned %>%
ggplot(aes(x = race, fill = food.security, y = 100*(..count..)/sum(..count..)))+
geom_bar(position = "dodge")+
theme_minimal()+
coord_flip()+
labs(x = "Race/Ethnicity", y = "Percent of total participants", subtitle = "Food Security and Race/Ethnicity")+
scale_color_brewer(palette = "Set2")+
guides(fill = guide_legend(title = "Degree of Food Security"))
print(bar.food.security.race)
Most respondents with full food security (45.9%), marginal food security (34%), low food security (30.6%), and very low food security were non-Hispanic White(44.6%).
bar.food.security.education.level <- nhanes.food.cleaned %>%
ggplot(aes(x = education.level, fill = food.security, y = 100*(..count..)/sum(..count..)))+
geom_bar(position = "dodge")+
theme_minimal()+
coord_flip()+
labs(x = "Education Level", y = "Percent of total participants", subtitle = "Food Security and Education Level")+
scale_color_brewer(palette = "Set2")+
guides(fill = guide_legend(title = "Degree of Food Security"))
print(bar.food.security.education.level)
Most respondents with full food security were college graduates or above (31.9%). Most respondents with marginal food security (34.2%), low food security (26.6%), and very low food security (36.5%) had some college or an associates degree.
bar.food.security.household <- nhanes.food.cleaned %>%
ggplot(aes(x = household, fill = food.security, y = 100*(..count..)/sum(..count..)))+
geom_bar(position = "dodge")+
theme_minimal()+
coord_flip()+
labs(x = "Number of persons in household", y = "Percent of total participants", subtitle = "Food Security and Number of Persons in Household")+
scale_color_brewer(palette = "Set2")+
guides(fill = guide_legend(title = "Degree of Food Security"))
print(bar.food.security.household)
Most respondents with full food security had 2 persons in their household (31.0%). Most respondents with marginal food security had 4 persons in their household (18.7%). Most respondents with low food security(20.8%) and very low food security (24.7%) had 2 persons in their household.
Assumptions of ANOVA are:
+ Continuous variable and independent groups
+ Independent observations
+ Normal distribution within groups
+ Equal variances within groups
Continuous variable of age and independent observations met. Must test other 2 assumptions.
H0: Age is normally distributed across all degrees of food
security.
HA: Age is not normally distributed across all degrees of food
security.
nhanes.food.cleaned %>%
ggplot(aes(x=age))+
geom_density(aes(fill=food.security))+
facet_wrap(facets = vars(food.security), nrow=2)+
scale_fill_brewer(palette = "Set2", guide = "none")+
theme_minimal()+
labs(x = 'Age of participant',
y = 'Probability density')
Based on the density plots, none of the groups look normally distributed. Will confirm with Q-Q plots.
nhanes.food.cleaned %>%
ggplot(aes(sample=age))+
geom_abline(aes(intercept = mean(age), slope = sd(age), linetype = "Normally distributed"), color = "gray60", size = 1)+
stat_qq(aes(color = food.security))+
scale_color_brewer(palette = "Set2", guide = "none")+
scale_linetype_manual(values=1, name="")+
labs(x = "Theoretical normal distribution",
y = "Observed values of age")+
theme_minimal()+
facet_wrap(facets = vars(food.security), nrow = 2)
Based on the Q-Q plots, none of the groups look normally distributed. Will test for significance with Shapiro-Wilk test.
nhanes.food.cleaned %>%
group_by(food.security) %>%
summarize(shapiro.pval = shapiro.test(x = age)$p.value)
## # A tibble: 4 × 2
## food.security shapiro.pval
## <fct> <dbl>
## 1 adult full food security 7.24e-33
## 2 adult marginal food security 6.73e-12
## 3 adult low food security 2.38e-12
## 4 adult very low food security 1.09e- 8
Based on the p-values, all four of the Shapiro-Wilk tests were statistically significant, indicating that the null hypothesis for this test was rejected in each group. Age is not normally distributed in any groups of degree of food security. The ANOVA fails the assumption of normal distribution.
H0: Age has equal variances within all degrees of food
security.
HA: Age does not have equal variances within all degrees of food
security.
### Levene’s Test for equal variances
car::leveneTest(y = age ~ food.security, data = nhanes.food.cleaned, center = mean)
## Levene's Test for Homogeneity of Variance (center = mean)
## Df F value Pr(>F)
## group 3 13.647 7.214e-09 ***
## 5681
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
The p-value for the Levene’s test suggest rejecting the null hypothesis, the variances of age are statistically significantly different across groups (p<.05). The ANOVA fails the assumption of homogeneity of variances.
Assumptions of ANOVA are:
+ Continuous variable and independent groups - met
+ Independent observations - met
+ Normal distribution within groups - not met
+ Equal variances within groups - not met
Since not all ANOVA assumptions are met, we will use the Kruskal-Wallis Test for failing the normality assumption to compare ranks among groups.
H0: The mean age is equal across all degrees of food security. HA: The mean age is not equal across all degrees of food security.
kruskal.test(age ~ food.security, data = nhanes.food.cleaned)
##
## Kruskal-Wallis rank sum test
##
## data: age by food.security
## Kruskal-Wallis chi-squared = 150.68, df = 3, p-value < 2.2e-16
We used the Kruskal-Wallis test to test the null hypothesis that the mean age is equal across all degrees of food security. We rejected the null hypothesis and concluded that there was a statistically significant association mean age was not equal across all degrees of food security [H(4)=150.68; p <.05]. Now we will use Dunn’s post hoc test to identify which groups are statistically significantly different from which other groups.
dunn.test::dunn.test(x = nhanes.food.cleaned$age,
g = nhanes.food.cleaned$food.security,
method = "bonferroni")
## Kruskal-Wallis rank sum test
##
## data: x and group
## Kruskal-Wallis chi-squared = 150.6782, df = 3, p-value = 0
##
##
## Comparison of x by group
## (Bonferroni)
## Col Mean-|
## Row Mean | adult fu adult lo adult ma
## ---------+---------------------------------
## adult lo | 8.313696
## | 0.0000*
## |
## adult ma | 7.183853 -0.704839
## | 0.0000* 1.0000
## |
## adult ve | 8.079191 0.814502 1.444182
## | 0.0000* 1.0000 0.4461
##
## alpha = 0.05
## Reject Ho if p <= alpha/2
age.rank = rank(nhanes.food.cleaned$age, na.last = "keep")
nhanes.food.cleaned %>%
ggplot(aes(y = age.rank, x = food.security))+
geom_jitter(aes(color = food.security), alpha = .6)+
geom_boxplot(aes(fill = food.security), alpha = .4)+
scale_fill_brewer(palette = "Set2", guide = "none")+
scale_color_brewer(palette = "Set2", guide = "none")+
theme_minimal()+
labs(x = "Degree of Food Security", y = "Ranks of age")
The plot clearly demonstrates the significant differences seen in the post hoc tests. The three groups marginal food security, low food security and very low food security were similar to one another, but there were differences among those with full food security.
eta2[H] = (H - k + 1)/(n - k) eta2[H] = (150.68 - 4 + 1)/(5685-4) = .0260 eta2H effect size for Kruskal Wallis test is small (.0260). There is a small-strength relationship between degree of food security and age.
Interpretation: A Kruskal-Wallis test found a statistically significant difference in age across degree of food security groups (H = 150.68; p<.05). Based on Dunn’s post hoc test, those with full food security had statistically significantly higher mean ranked age than all of the other groups (p<.05), and people with marginal food security, low food security, and very low food security had significantly lower mean ranked age than those with full food security. There were no statistically significant differences among those with marginal food security, low food security, and very low food security. There was a small effect size for the relationship between degree of food security and ranked values of age (eta2[H]=.0260).
H0: Degree of food security is the same across race-ethnicity
groups.
HA: Degree of food security is not the same across race-ethnicity
groups.
chisq.test(x=nhanes.food.cleaned$food.security, y=nhanes.food.cleaned$race)
##
## Pearson's Chi-squared test
##
## data: nhanes.food.cleaned$food.security and nhanes.food.cleaned$race
## X-squared = 313.04, df = 15, p-value < 2.2e-16
Interpretation: We used the chi-squared test to test the null hypothesis that there was no relationship between degree of food security and race-ethnicity group. We rejected the null hypothesis and concluded that there was a statistically significant association between degree of food security and race-ethnicity [x-squared = 313.04; p <.05].
H0: Degree of food security is the same across education
levels.
HA: Degree of food security is not the same across education levels.
chisq.test(x=nhanes.food.cleaned$food.security, y=nhanes.food.cleaned$education.level)
##
## Pearson's Chi-squared test
##
## data: nhanes.food.cleaned$food.security and nhanes.food.cleaned$education.level
## X-squared = 452.96, df = 12, p-value < 2.2e-16
Interpretation: We used the chi-squared test to test the null hypothesis that there was no relationship between degree of food security and education level. We rejected the null hypothesis and concluded that there was a statistically significant association between degree of food security and education level [x-squared = 452.96; p <.05].
H0: Degree of food security is the same across all amounts of
individuals living in a household.
HA: Degree of food security is not the same across all amounts of
individuals living in a houshold.
chisq.test(x=nhanes.food.cleaned$food.security, y=nhanes.food.cleaned$household)
##
## Pearson's Chi-squared test
##
## data: nhanes.food.cleaned$food.security and nhanes.food.cleaned$household
## X-squared = 254.45, df = 18, p-value < 2.2e-16
Interpretation: We used the chi-squared test to test the null hypothesis that there was no relationship between degree of food security and number of persons living in a household. We rejected the null hypothesis and concluded that there was a statistically significant association between degree of food security and number of persons living in a household [x-squared = 254.45; p <.05].
In regards to the age of participants, we see that those with full food security had statistically significantly higher mean ranked age than all other groups and people with marginal food security, low food security, and very low food security had significantly lower mean ranked age than those with full food security. This to say, it appears that those who are older in age are more likely to have full food security than those who are younger. Walker, et. al’s study found a similar result in which those >65 years of age were 39% less likely to report food insecurity compared to those ages 18–34 (1). Rose’s study also took a deeper look into the association between age and food security; he explained that while there are many factors that would explain why elderly persons would have lower food security, the data usually shows these persons typically have higher food security due to factors such as life-savings or paid off mortgages and reluctance to state food insufficiency (2). This could potentially aid in explaining the phenomena we see in our results, and both studies confirm what we discovered in our results.
In regards to race/ethnicity, education level, and number of persons in household, we found that there was a statistically significant association between degree of food security and the other variable (race/ethnicity, education level, and number of persons in household). This confirms that all variables (age, race/ethnicity, education level, and number of persons in household) are significantly associated with the degree of food security. Olsen, et. al with the Research Institute on Poverty had similar findings of the significance of race/ethnicity, education level, and number of persons in household in their association to food security (3). In another study using CSFII and SIPP survey data, the significance of education level was noted to be significant as it impacts not only present and future income but also purchasing efficacy, food knowledge, and meal preparation skills (4). Unfortunately, NHANES data regarding food security was collected from predominantly White Americans living in 2-person households with some college education or higher. This causes most degree of food security categories at face-value to be within these demographics. For further analysis, we would need to stratify based on different demographics and adjust for any confounding. Nam, et. al had interesting findings through the use of regressions by race/ethnicity used for decomposition analyses (5). Through this analysis greater understanding and interpretations were able to be made regarding the racial and ethnic disparities of food insecurity and the specific economic and uneconomic constraints tied to that food insecurity. Further analysis will be needed and the use of linear regression encouraged to interpret more from this data.