Kornelia
2025-12-03
Over the past several years, U.S. households have faced rising food costs, particularly since the COVID-19 pandemic and subsequent supply chain disruptions.
Key Issues:
This Analysis:
# Download food price data from FRED
food_home <- fredr(series_id = "CUSR0000SAF11",
observation_start = as.Date("2018-01-01"),
observation_end = as.Date("2023-12-31"))
food_away <- fredr(series_id = "CUSR0000SEFV",
observation_start = as.Date("2018-01-01"),
observation_end = as.Date("2023-12-31"))
# Calculate monthly YoY inflation on full series
monthly_home <- food_home %>%
arrange(date) %>%
mutate(
inflation_home = (value / lag(value, 12) - 1) * 100,
year = lubridate::year(date)
)
monthly_away <- food_away %>%
arrange(date) %>%
mutate(
inflation_away = (value / lag(value, 12) - 1) * 100,
year = lubridate::year(date)
)
# Compute annual averages for 2019-2023
annual_inflation <- monthly_home %>%
filter(year >= 2019, year <= 2023) %>%
group_by(year) %>%
summarise(avg_inflation_home = mean(inflation_home, na.rm = TRUE), .groups = "drop")
inflation_away <- monthly_away %>%
filter(year >= 2019, year <= 2023) %>%
group_by(year) %>%
summarise(avg_inflation_away = mean(inflation_away, na.rm = TRUE), .groups = "drop")
# Combine inflation data
inflation_data <- annual_inflation %>%
left_join(inflation_away, by = "year") %>%
mutate(avg_inflation_total = (avg_inflation_home + avg_inflation_away) / 2)# Load food security data (combined from CPS-FSS annual files)
food_security <- read_csv("food_security_annual_summary.csv", show_col_types = FALSE) %>%
filter(year >= 2019, year <= 2023)
# Merge all data
data <- inflation_data %>%
left_join(food_security, by = "year")| Year | Avg Inflation (%) | Food Insecure (%) | Food Secure (%) | Very Low Security (%) |
|---|---|---|---|---|
| 2019 | 1.98 | 10.78 | 88.99 | 3.61 |
| 2020 | 3.42 | 11.65 | 88.10 | 3.76 |
| 2021 | 4.00 | 10.36 | 89.51 | 3.44 |
| 2022 | 9.52 | 13.38 | 86.40 | 4.88 |
| 2023 | 6.12 | 14.16 | 85.72 | 4.92 |
Note: Food security data collected from ~120,000 households per year via CPS Food Security Supplement
Food Inflation:
Food Insecurity:
+3.4 percentage points from 2019 to 2023
# Correlation
cor_result <- cor(data$avg_inflation_total, data$food_insecure_pct,
use = "complete.obs")
# Regression
model1 <- lm(food_insecure_pct ~ avg_inflation_total, data = data)Interpretation: For every 1% increase in food inflation, food insecurity increases by approximately 0.42 percentage points.
Strong Positive Correlation (r = 0.753)
Regression Results
Limitations
# Download spending data
pce_food <- fredr(series_id = "DFOORC1A027NBEA",
observation_start = as.Date("2019-01-01"),
observation_end = as.Date("2023-12-31"))
pce_services <- fredr(series_id = "DFSARC1A027NBEA",
observation_start = as.Date("2019-01-01"),
observation_end = as.Date("2023-12-31"))
# Calculate annual spending
spending <- pce_food %>%
mutate(year = year(date)) %>%
filter(year >= 2019, year <= 2023) %>%
group_by(year) %>%
summarise(food_home_spending = mean(value), .groups = "drop")
services <- pce_services %>%
mutate(year = year(date)) %>%
filter(year >= 2019, year <= 2023) %>%
group_by(year) %>%
summarise(food_away_spending = mean(value), .groups = "drop")
# Combine and calculate ratio
spending_data <- spending %>%
left_join(services, by = "year") %>%
left_join(inflation_data, by = "year") %>%
mutate(
home_away_ratio = (food_home_spending / food_away_spending) * 100,
pct_change_ratio = (home_away_ratio / lag(home_away_ratio) - 1) * 100
)| Year | Inflation (%) | Home/Away Ratio (%) | Change from Prior Year (%) |
|---|---|---|---|
| 2019 | 1.98 | 2.65 | NA |
| 2020 | 3.42 | 2.89 | 9.23 |
| 2021 | 4.00 | 2.45 | -15.28 |
| 2022 | 9.52 | 2.39 | -2.41 |
| 2023 | 6.12 | 2.38 | -0.23 |
# Correlation
cor_spending <- cor(spending_data$avg_inflation_total,
spending_data$home_away_ratio,
use = "complete.obs")Negative Correlation (r = -0.644)
The Pattern:
Possible Explanations:
# Create lagged variables
lagged_data <- data %>%
arrange(year) %>%
mutate(
inflation_lag1 = lag(avg_inflation_total, 1),
inflation_lag2 = lag(avg_inflation_total, 2)
)
# Calculate correlations for different lags
cors <- tibble(
Lag = c("Same Year", "1-Year Lag", "2-Year Lag"),
Correlation = c(
cor(lagged_data$avg_inflation_total, lagged_data$food_insecure_pct,
use = "complete.obs"),
cor(lagged_data$inflation_lag1, lagged_data$food_insecure_pct,
use = "complete.obs"),
cor(lagged_data$inflation_lag2, lagged_data$food_insecure_pct,
use = "complete.obs")
),
N = c(5, 4, 3)
)| Time Lag | Correlation | Sample Size |
|---|---|---|
| Same Year | 0.753 | 5 |
| 1-Year Lag | 0.734 | 4 |
| 2-Year Lag | 0.996 | 3 |
Contemporaneous Effects Dominate
What This Tells Us:
Important Caveats:
This analysis reveals a strong, immediate relationship between food price inflation and household food insecurity during the 2019-2023 period.
Key insights: