2025-11-02

Introduction

This presentation explores air quality data collected across Queens, NY as part of the 2024 Air Quality Sensor Pilot. The dataset was downloaded from data.gov (NYC Open Data) and analyzed using tidyverse, plotly, and a bonus of shiny analysis practice.The main goal is to visualize temporal and spatial patterns in fine particulate matter (PM₂.₅), revealing how concentrations shift across months and neighborhoods in Queens.

About the Dataset

- Source: NYC Open Data — Queens Air Quality Sensor Pilot (Feb–Nov 2024)
- Variables:
- startOfPeriod / endOfPeriod: Hourly measurement time stamps
- locationLatitude/locationLongitude: Sensor coordinates -pm2_5ConcMass1HourMean.value: Hourly PM₂.₅ concentration (µg/m³) -pm2_5ConcMassNowcastUsEpaAqi.value`: EPA Nowcast Air Quality Index (AQI)
- Purpose of Project: To identify seasonal and spatial air-quality trends, evaluate PM₂.₅ variation by time, and compare readings with EPA AQI estimates.

Brief Overview

-Monthly PM₂.₅ Variation (Box plot) – Displays how particulate matter levels fluctuate each month, revealing seasonal patterns in Queens’ air quality. -AQI vs. PM₂.₅ Relationship (Scatter Plot) – Compares AQI and PM₂.₅ values to show how increases in particulate matter correspond to higher air quality index readings. -PM₂.₅ Over Time (Interactive Line Plot) – Tracks daily and monthly changes in PM₂.₅, highlighting periods of elevated pollution across the year. -3D Spatial Visualization (3D Scatter Plot) – Maps PM₂.₅ levels by latitude and longitude to illustrate geographic differences in pollution within Queens. - One-way ANOVA (Statistical Output) – Evaluates tests whether average PM₂.₅ concentrations differ across months, helping identify if time of year (month) has a measurable effect on pollution levels. particulate pollution levels. -Shiny App Exploration (Interactive Dashboard) – Enables dynamic filtering and visualization of PM₂.₅ data by month or concentration, allowing users to explore air quality trends interactively.

Monthly PM₂.₅ Variation (ggplot())

This plot summarizes how fine particulate matter (PM₂.₅) levels changed across months in 2024. Each box represents the monthly distribution, showing when air quality was cleaner or more polluted over time.

AQI vs PM₂.₅ (ggplot())

This scatter plot compares measured PM₂.₅ values with the EPA’s Nowcast Air Quality Index. The positive relationship confirms that higher AQI readings correspond to higher pollution levels.

Linear Plot Code

To create an easy visualization of PM₂.₅ concentrations overtime, the following code is attached below:

plot_ly(air, x = ~month, y = ~pm25, color = ~month, type = 'scatter', mode = 'lines+markers') %>%
  layout(
    title = "PM2.5 Concentrations Over Time",
    xaxis = list(title = "Month"),
    yaxis = list(title = "PM2.5 (µg/m³)")
  )

Interactive Plot — PM₂.₅ Over Time (plot_ly())

This interactive line plot tracks PM₂.₅ concentrations through the months. It helps visualize day-to-day and seasonal changes and makes it easy to spot spikes or persistent high-pollution periods.

3D Visualization (plot_ly())

This 3D scatter plot displays PM₂.₅ levels by latitude and longitude, highlighting where pollutant concentrations are higher across Queens. It provides a spatial sense of air quality variation.

one-way ANOVA Statistical anlayiss

The one-way ANOVA revealed a highly significant effect of month on PM₂.₅ concentrations (F(10, 67081) = 686.8, p < 0.001).This means that average particulate matter levels differed substantially between months, confirming that air quality in Queens was not consistent throughout the year.The large F-value and very small p-value indicate that these differences are unlikely due to random variation.

##                Df  Sum Sq Mean Sq F value Pr(>F)    
## month          10  162891   16289   686.8 <2e-16 ***
## Residuals   67081 1590995      24                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Shiny App — Queens Air Quality Explorer

Here is the interactive app for Shiny. I completed it to practice module 5.

Shiny applications not supported in static R Markdown documents

Conclusion

- Seasonal Trends: PM₂.₅ concentrations in Queens rise during late summer and early fall when atmospheric mixing is weaker.
- AQI Relationship: The correlation between AQI and PM₂.₅ confirms the sensors’ accuracy and reflects real-world conditions.
- Spatial Patterns: Slightly higher PM₂.₅ levels appear in western Queens, near denser traffic corridors.
- Public Health: Prolonged high PM₂.₅ exposure is linked to respiratory stress, emphasizing the need for continuous community-level monitoring.
- Analytical Value: Tools like Plotly and Shiny enable dynamic exploration of environmental data and clear public communication.
- Future Work: Expanding with Leaflet or usmap for mapping, integrating live AQI feeds, and building predictive models could enhance forecasting and urban air-quality planning.