In: Statistics and Probability
**Using RStudio**Please show code**
(airquality) What is the relationship between temperature and ozone levels in New York and how does the month influence this? Make a plot that would illustrate this relationship (hint: make sure you change Month into a factor, you don't need to include a line of best fit for this plot because there are so many categories in month).
here I attach the R code with outputs
airquality
plot(airquality$Ozone,airquality$Temp)
m=lm(airquality$Ozone~airquality$Temp)
summary(m)
m2=lm(airquality$Ozone~airquality$Temp+airquality$Month)
summary(m2)
Here there is linear relationship between ozone levels and temperature in New York.
The linear relation is:
Ozone level = -146.9955+2.4287*Temperature
Here the variable is significant since the p value is less than 0.05.
Now we add month to this model as a factor it has 5 levels(5,6,7,8,9), the variable month is not all levels are significant.
The significance of each level can be verified by the p value.