What Is The State of Food Security and Nutrition in the US?

Lets import data on Food insecurity in the US

Map_data <- read.csv('https://raw.githubusercontent.com/Kingtilon1/DATA608/main/mapdata2022%20-%20Map%20Data%20%20-%20mapdata2022%20-%20Map%20Data%20(1)%20(1).csv')
glimpse(Map_data)
## Rows: 52
## Columns: 7
## $ State                             <chr> "U.S.", "AK", "AL", "AR", "AZ", "CA"…
## $ Number.of.households              <chr> "131,744,000", "273,000", "2,062,000…
## $ Interviewed                       <chr> "96,426", "1,155", "1,806", "1,748",…
## $ Food.insecurity.Prevalence        <dbl> 11.2, 9.5, 12.4, 16.6, 10.2, 10.3, 8…
## $ Margin.of.error2                  <dbl> 0.20, 2.20, 2.02, 1.75, 1.62, 0.62, …
## $ Very.low.food.security.Prevalence <dbl> 4.3, 4.2, 4.7, 6.5, 4.0, 3.8, 3.4, 3…
## $ Margin.of.error2.1                <dbl> 0.13, 1.25, 1.07, 0.98, 0.95, 0.43, …

Which states are rank higher for food insecurity?

sorted_data <- Map_data[order(-Map_data$Food.insecurity.Prevalence), ]

fig <- plot_ly(sorted_data, x = ~State, y = ~Food.insecurity.Prevalence, type = "bar") %>%
  layout(title = "Food Insecurity Prevalence by State",
         xaxis = list(title = "State"),
         yaxis = list(title = "Food Insecurity Prevalence"))

table_data <- head(sorted_data[, c("State", "Food.insecurity.Prevalence", "Very.low.food.security.Prevalence")], 5)

fig
table_data
##    State Food.insecurity.Prevalence Very.low.food.security.Prevalence
## 4     AR                       16.6                               6.5
## 45    TX                       15.5                               5.8
## 27    MS                       15.3                               5.3
## 20    LA                       15.2                               6.1
## 42    SC                       14.5                               6.8

Notice how Arkansas ranks the highest in food insecurity,followed by TEXAS, Based off of th e heat map we see that states towards the south have the higher value in terms of food insecurity, this can be due to poverty rates, which tend to be higher in southern states, or unemployment.

Visualization with heat map

Map_data$Full_State <- state.name[match(Map_data$State, state.abb)]

fig <- plot_geo(Map_data, locationmode = "USA-states") %>%
  add_trace(
    z = ~Food.insecurity.Prevalence,
    locations = ~State,
    text = ~paste("State: ", Full_State,
                   "<br>Food Insecurity Prevalence: ", Food.insecurity.Prevalence,
                   "<br>Very Low Food Security Prevalence: ", Very.low.food.security.Prevalence,
                   "<br>Number of Households: ", Number.of.households),
    colorscale = "Viridis",
    colorbar = list(title = "Food Insecurity Prevalence")
  ) %>%
  layout(
    title = "Food Insecurity Prevalence by State",
    geo = list(scope = "usa", projection = list(type = "albers usa"))
  )

fig

Is there a correlation between poverty levels and food security?

This Data set contains information on

Poverty_rate <- read.csv('https://raw.githubusercontent.com/Kingtilon1/DATA608/main/poverty-rate-by-state-2024.csv')

Poverty_rate <- Poverty_rate %>%
  mutate(State = state.abb[match(state, state.name)]) %>%
  select(State, everything())

Poverty_rate <- Poverty_rate %>%
  select(-state)

# Drop rows where the 'State' column is NA
Poverty_rate <- na.omit(Poverty_rate)

sorted_data <- Poverty_rate[order(-Poverty_rate$PovertyRatesPercentOfPopulationBelowPovertyLevel), ]
head(sorted_data)
##    State PovertyRatesPopulationBelowPovertyLevel
## 19    LA                                  883236
## 25    MS                                  554152
## 32    NM                                  382798
## 49    WV                                  291930
## 18    KY                                  721878
## 4     AR                                  480153
##    PovertyRatesPercentOfPopulationBelowPovertyLevel
## 19                                             19.6
## 25                                             19.4
## 32                                             18.4
## 49                                             16.8
## 18                                             16.5
## 4                                              16.3

Display the data as a heat map

Poverty_rate$Full_State <- state.name[match(Poverty_rate$State, state.abb)]

fig <- plot_geo(Poverty_rate, locationmode = "USA-states") %>%
  add_trace(
    z = ~PovertyRatesPercentOfPopulationBelowPovertyLevel,
    locations = ~State,
    text = ~paste("State: ", Full_State),
    colorscale = "Viridis",
    colorbar = list(title = "Poverty by State")
  ) %>%
  layout(
    title = "Poverty Rate Prevalence by State",
    geo = list(scope = "usa", projection = list(type = "albers usa"))
  )

fig

It appears that states with higher levels of food insecurity also tend to exhibit higher poverty rates visually

Lets use a scatter plot to better visualize the correlation by combining both the Poverty_rate data frame and the Map_data dataframe first

merged_data <- merge(Poverty_rate, Map_data, by = "State", all = TRUE)

plot_ly(merged_data, x = ~PovertyRatesPercentOfPopulationBelowPovertyLevel, y = ~Food.insecurity.Prevalence, type = "scatter", mode = "markers",
        marker = list(color = "blue")) %>%
  layout(title = "Poverty Rate vs. Food Insecurity Prevalence",
         xaxis = list(title = "Poverty Rate"),
         yaxis = list(title = "Food Insecurity Prevalence"))
## Warning: Ignoring 2 observations

The scatter plot shows a clear positive trend between poverty rate and food insecurity prevalence. As poverty rate increases, so does food insecurity. This suggests a strong relationship between socioeconomic factors and access to food resources. Addressing poverty is crucial for reducing food insecurity.

As we get older do we become fully functional citizens, or do they require continued support?

Store data frame

Food_by_age <- read.csv('https://raw.githubusercontent.com/Kingtilon1/DATA608/main/Food%20insecurity%20by%20gender%2C%20and%20age%20-%20US.csv')

Increasing_age <- read.csv('https://raw.githubusercontent.com/Kingtilon1/DATA608/main/age%20-%20Sheet1.csv')
colnames(Food_by_age) <- NULL
# Assign the first row as the new header
colnames(Food_by_age) <- Food_by_age[1, ]

# Remove the first row (since it's now the header)
Food_by_age <- Food_by_age[-1, ]
colnames(Food_by_age)[1] <- "categories"
colnames(Food_by_age)[2] <- "total"
male_data <- subset(Food_by_age, categories == "Male")
female_data <- subset(Food_by_age, categories == "Female")
Increasing_age <- Increasing_age[Increasing_age$Age != "Total", ]

Increasing_age$Age <- factor(Increasing_age$Age, levels = unique(Increasing_age$Age))

fig <- plot_ly(Increasing_age, x = ~Age, y = ~Number.of.SNAP.participants..Millions., type = 'scatter', mode = 'line')

fig <- fig %>% layout(
  xaxis = list(title = 'Age', type = 'category'),  
  yaxis = list(title = 'Number of SNAP participants (Millions)'),  
  title = 'Trend of SNAP Participants by Age'  
)

fig

This graph illustrates the age distribution of individuals participating in the Supplemental Nutrition Assistance Program (SNAP), providing a valuable benchmark for assessing support needs as individuals age.

Based on the upward trend depicted by the positive linear line in the graph, we observe a steady increase in the number of SNAP participants as ages progress from younger than 5 to 59. However, beyond the age of 59, there is a notable decline in participation rates. This decrease may be attributed to factors such as retirement, changes in financial circumstances, or shifts in eligibility criteria. Further exploration of these factors could provide insights into the observed trend.

Resources

USDA.gov

World Population Reveiw

Distirbution of SNAP participants by age