Our Question

How are Temperature and Ozone levels related?

We will explore if warmer days correlate to having higher ozone levels by using the built-in airquality data set in R.

About the Data

The airquality data set features recorded data from May-September of 1973 with 153 daily observations from New York about the states airquality.

The information we will focus on within the airquality dataset are:

  • Temp: Maximum daily temperature in Fahrenheit

  • Ozone: mean ozone concentration in ppb (parts per billion)

head(airquality)
##   Ozone Solar.R Wind Temp Month Day
## 1    41     190  7.4   67     5   1
## 2    36     118  8.0   72     5   2
## 3    12     149 12.6   74     5   3
## 4    18     313 11.5   62     5   4
## 5    NA      NA 14.3   56     5   5
## 6    28      NA 14.9   66     5   6

What is Correlation?

Correlation is the strength and connection of a linear relationship between two variables.

  • Positive correlation: as one variable increases, the other also increases.
  • Negative correlation: as one variable increases, the other tends to decrease.
  • Zero correlation: There seems to be no linear relationship

How Are Ozone Levels Distributed?

Ozone levels are right-skewed where most recorded days had lower levels, while a smaller number had much higher levels.

Temperature and Ozone

The scatter plot demonstrates a positive association where warmer days tend to have higher ozone levels. There is still variation to where even on days with similar temperatures, ozone levels can be different.

Adding a Regression Line

The regression line has an upward slope, which shows that higher temperatures are linked to higher ozone levels. Since all points dont stay on the line, the temperature alone does not fully predict ozone levels.

Understanding the Regression Model

Equation of a linear regression model:

\[ y=\beta_0+ \beta_1 x+ \varepsilon \]

  • \(y\) = the ozone level

  • \(x\) = the maximum daily temperature

  • \(\beta_0\) = the intercept

  • \(\beta_1\) = is the slope or how much the expected ozone level changes when temperature increases by 1 degree Fahrenheit

  • \(\varepsilon\) = how much a day’s ozone level is different from what the model expects at that temperature

A positive slope means that warmer days tend to have higher ozone levels.

Fitting the Model in R

ozone_model<-lm(Ozone~ Temp, data=airquality)
ozone_model
## 
## Call:
## lm(formula = Ozone ~ Temp, data = airquality)
## 
## Coefficients:
## (Intercept)         Temp  
##    -146.995        2.429

This model utilizes temperature to predict ozone levels.

R gives us the intercept and slope needed to write the regression equation.

Our Regression Equation

The fitted regression equation is:

\[ \widehat{ozone} = -146.995 + 2.429(Temp) \]

For each 1 degree Fahrenheit increase in temperature, the model predicts an increase of around 2.429 ppb in ozone.

Exploring Patterns by Month

The colors distinguish the months(ex: 5 = May)

The points help to identify when unusually high ozone levels occurred and to compare days with similar temperatures.

The highest recorded ozone level was 168 ppb on August 25th at the maximum temperature of 81 Fahrenheit. This did not occur on the hottest day, which shows that temperature alone does not predict ozone levels.

What Did We Learn?

  • Warmer days tended to have higher ozone levels.
  • Majority recorded days had lower ozone levels, while very high ozone levels happened on fewer days, creating a right-skewed distribution.
  • There is around 2.43 ppb more ozone for each 1 degree Fahrenheit increase in temperature.
  • Days with similar temperatures can still have different ozone levels.
  • This does not prove that temperature by itself causes higher ozone levels.
  • The highest ozone level was 168 ppb on August 25th at the maximum temperature of 81 degrees Fahrenheit. This shows that the highest ozone level did not occur on the hottest day.