The New York City Farmers’ Markets are an essential part of the city’s public health and food access ecosystem. These markets serve as community hubs, offering fresh produce and often participating in nutrition assistance programs. Understanding how these markets operate across boroughs and whether they promote equitable access to healthy food options is crucial, particularly for policy initiatives aimed at food insecurity and nutrition outreach.
For this analysis, I focus on the following key variables from the NYC Farmers’ Markets dataset:
accepts_ebt_bin: Whether the market
accepts EBT (Electronic Benefit Transfer), recoded into binary form (1 =
Yes, 0 = No).health_bucks_bin: Whether the market
distributes Health Bucks (1 = Yes, 0 = No).open_year_round_bin: Whether the
market operates year-round (1 = Yes, 0 = No).Borough: The NYC borough in which the
market is located.To investigate these research questions, I use logistic regression
models, treating accepts_ebt_bin as the
dependent variable. Predictor variables include: -
distributes_health_bucks - open_year_round -
borough
The analysis includes: - Data cleaning and transformation -
Descriptive statistics using datasummary_skim() -
Regression modeling with glm() - Simulation and
interpretation of average marginal effects using the
clarify package - Visualization and formatted tables with
gt and modelsummary
farmers_markets <- read.csv("C:/Users/susha/Downloads/NYC_Farmers_Markets_20241107.csv")
head(farmers_markets)
## Borough Market.Name
## 1 Manhattan Harvest Home East Harlem Farmers Market
## 2 Brooklyn Seeds in the Middle - Flatbush - Hillel Plaza Farm Stand
## 3 Bronx Morris Heights Farmstand
## 4 Bronx 170 Farm Stand
## 5 Bronx JBOLC Garden Community Farmers Market
## 6 Queens Perez Farm Stand
## Street.Address Community.District Latitude
## 1 E. 104th St. & 3rd Ave. 111 40.79030
## 2 Flatbush/Nostrand Triangle 314 40.63262
## 3 University Ave. and W. 179th St. 205 40.85457
## 4 1406 Townsend Ave. 204 40.84014
## 5 Sedgwick Ave. & Goulden Ave. 207 40.88265
## 6 134-20 Jamaica Ave., by the Axel Building 409 40.70236
## Longitude Days.of.Operation Hours.of.Operations Season.Begin
## 1 -73.94563 Thursday 8AM - 3PM 06/15/2023 12:00:00 AM
## 2 -73.94744 Wednesday 4PM - 7PM 01/01/2023 12:00:00 AM
## 3 40.85457 Wednesday 11AM - 3PM 03/27/2023 12:00:00 AM
## 4 -73.91659 Wednesday 2PM - 6PM 07/12/2023 12:00:00 AM
## 5 -73.88656 Saturday 10AM - 3PM 06/17/2023 12:00:00 AM
## 6 -73.81853 Wednesday 10AM - 4PM 06/14/2023 12:00:00 AM
## Season.End Accepts.EBT Distributes.Health.Bucks. Open.Year.Round
## 1 11/16/2023 12:00:00 AM Yes Yes No
## 2 12/31/2023 12:00:00 AM Yes Yes No
## 3 11/29/2023 12:00:00 AM Yes Yes No
## 4 11/22/2023 12:00:00 AM Yes Yes No
## 5 10/28/2023 12:00:00 AM Yes Yes No
## 6 11/01/2023 12:00:00 AM Yes Yes No
## Cooking.Demonstrations Location.Point Zip.Code
## 1 No (40.7903, -73.945635) 10029
## 2 No (40.63262, -73.947439) 11210
## 3 No (40.854567, 40.854567) 10453
## 4 Yes (40.840138, -73.916591) 10452
## 5 No (40.882647, -73.886562) 10468
## 6 No (40.70236, -73.818531) 11418
colnames(farmers_markets)
## [1] "Borough" "Market.Name"
## [3] "Street.Address" "Community.District"
## [5] "Latitude" "Longitude"
## [7] "Days.of.Operation" "Hours.of.Operations"
## [9] "Season.Begin" "Season.End"
## [11] "Accepts.EBT" "Distributes.Health.Bucks."
## [13] "Open.Year.Round" "Cooking.Demonstrations"
## [15] "Location.Point" "Zip.Code"
table(farmers_markets$Accepts.EBT)
##
## No TBD yes Yes
## 7 3 1 152
farmers_markets <- farmers_markets %>%
mutate(accepts_ebt = case_when(
Accepts.EBT %in% c("Yes", "yes") ~ 1,
Accepts.EBT %in% c("No", "TBD") ~ 0,
TRUE ~ NA_real_))
farmers_markets$accepts_ebt <- as.factor(farmers_markets$accepts_ebt)
table(farmers_markets$accepts_ebt)
##
## 0 1
## 10 153
farmers_markets <- farmers_markets %>%
mutate(
open_year_round = ifelse(Open.Year.Round == "Yes", 1, 0),
open_year_round = as.factor(open_year_round),
distributes_health_bucks = ifelse(Distributes.Health.Bucks. == "Yes", 1, 0),
distributes_health_bucks = as.factor(distributes_health_bucks),
borough = as.factor(Borough)
)
table(farmers_markets$distributes_health_bucks)
##
## 0 1
## 18 145
table(farmers_markets$open_year_round)
##
## 0 1
## 134 29
table(farmers_markets$accepts_ebt)
##
## 0 1
## 10 153
table(farmers_markets$borough)
##
## Bronx Brooklyn Manhattan Queens Staten Island
## 31 61 42 24 5
We created three logistic regression models:
Model 1: Considers only the borough of the market.
Model 2: Adds open_year_round to see if year-round operation impacts EBT acceptance.
Model 3: Includes distributes_health_bucks to assess its impact on EBT acceptance.
# Model 1:
model1 <- glm(accepts_ebt ~ borough, data = farmers_markets, family = binomial)
# Model 2:
model2 <- glm(accepts_ebt ~ borough + open_year_round, data = farmers_markets, family = binomial)
# Model 3:
model3 <- glm(accepts_ebt ~ borough + open_year_round + distributes_health_bucks, data = farmers_markets, family = binomial)
anova(model1, model2, test = "Chisq")
## Analysis of Deviance Table
##
## Model 1: accepts_ebt ~ borough
## Model 2: accepts_ebt ~ borough + open_year_round
## Resid. Df Resid. Dev Df Deviance Pr(>Chi)
## 1 158 67.165
## 2 157 62.652 1 4.5132 0.03363 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
anova(model2, model3, test = "Chisq")
## Analysis of Deviance Table
##
## Model 1: accepts_ebt ~ borough + open_year_round
## Model 2: accepts_ebt ~ borough + open_year_round + distributes_health_bucks
## Resid. Df Resid. Dev Df Deviance Pr(>Chi)
## 1 157 62.652
## 2 156 18.867 1 43.785 3.665e-11 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
anova(model3, model1, test = "Chisq")
## Analysis of Deviance Table
##
## Model 1: accepts_ebt ~ borough + open_year_round + distributes_health_bucks
## Model 2: accepts_ebt ~ borough
## Resid. Df Resid. Dev Df Deviance Pr(>Chi)
## 1 156 18.867
## 2 158 67.165 -2 -48.298 3.252e-11 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
models <- list(model1, model2, model3)
# Create a table of model summaries
modelsummary(models)
| (1) | (2) | (3) | |
|---|---|---|---|
| (Intercept) | 19.566 | 20.474 | 19.372 |
| (1931.478) | (3144.316) | (6899.764) | |
| boroughBrooklyn | -16.604 | -17.722 | -19.777 |
| (1931.478) | (3144.316) | (6899.764) | |
| boroughManhattan | -17.001 | -18.277 | -20.470 |
| (1931.478) | (3144.316) | (6899.764) | |
| boroughQueens | -17.957 | -19.027 | -20.065 |
| (1931.478) | (3144.316) | (6899.764) | |
| boroughStaten Island | -0.000 | -0.211 | -19.718 |
| (5182.699) | (8240.835) | (22234.772) | |
| open_year_round1 | 18.139 | 19.154 | |
| (3182.055) | (7145.938) | ||
| distributes_health_bucks1 | 22.618 | ||
| (3734.209) | |||
| Num.Obs. | 163 | 163 | 163 |
| AIC | 77.2 | 74.7 | 32.9 |
| BIC | 92.6 | 93.2 | 54.5 |
| Log.Lik. | -33.583 | -31.326 | -9.433 |
| F | 0.756 | 0.521 | 0.037 |
| RMSE | 0.23 | 0.23 | 0.14 |
The following models were fitted:
# Simulate coefficients for model3
sim_coefs <- sim(model3)
# Compute AME for 'distributes_health_bucks'
sim_est <- sim_ame(sim_coefs, var = "distributes_health_bucks", contrast = "rd", verbose = FALSE)
summary(sim_est)
## Estimate 2.5 % 97.5 %
## E[Y(0)] 5.78e-01 1.40e-01 6.85e-01
## E[Y(1)] 1.00e+00 2.22e-16 1.00e+00
## RD 4.22e-01 -4.93e-01 6.98e-01
sim_df <- as.data.frame(summary(sim_est))
kable(sim_df, digits = 3, caption = "Simulated AME Summary") %>%
kable_styling(full_width = FALSE)
| Estimate | 2.5 % | 97.5 % | |
|---|---|---|---|
| E[Y(0)] | 0.578 | 0.140 | 0.685 |
| E[Y(1)] | 1.000 | 0.000 | 1.000 |
| RD | 0.422 | -0.493 | 0.698 |
Based on the analysis, I found that several factors significantly influence whether a farmers’ market accepts EBT in New York City. The borough in which the market is located was one of the most notable factors, with markets in boroughs like Brooklyn, Manhattan, and Queens being less likely to accept EBT compared to Staten Island. Additionally, markets that operate year-round and those that distribute Health Bucks show a significantly higher likelihood of accepting EBT. This suggests that location, the operational model, and financial incentives play an important role in EBT adoption at farmers’ markets.
These findings help answer my research questions by highlighting how both geographic and operational factors contribute to EBT acceptance. The hypothesis that certain boroughs would be less likely to accept EBT was supported, and the idea that year-round operation and Health Bucks distribution would increase EBT acceptance was also confirmed. This analysis provides insight into the factors that could be targeted to improve EBT access at farmers’ markets, ultimately helping to enhance food security and access to healthy food for low-income communities across NYC.
Future studies could look into the impact of other socio-economic factors (e.g., average income, educational levels) or assess the role of government policies in encouraging farmers’ markets to adopt EBT.
In this assignment, the following key source was referenced to provide context, methodology, and data analysis techniques:
New York City Open Data. (2023). Farmers Markets Dataset. Retrieved from https://opendata.cityofnewyork.us/ - Used as the primary data source for the analysis of farmers’ markets in New York City and their EBT acceptance status.