In: Statistics and Probability
WILL RATE HIGH! question 2.4.1, problem 6 The data set airquality is one of R’s included data sets. It shows daily measurements of ozone concentration (Ozone), solar radiation (Solar.R), wind speed (Wind), and temperature (Temp) for 5 summer months in 1977 in New York City. Some of the observations are missing and are recorded as NA, meaning not available. View an overall summary of the variables in airquality with the command > summary(airquality) Ignore the summaries for Month and Day since those variables should be factors, not numeric variables, and their summaries are meaningless. Attach airquality to your workspace Go to TOC CHAPTER 2. DESCRIPTIVE AND GRAPHICAL STATISTICS 33 > attach(airquality) and make boxplots of Ozone, Solar.R, Wind, and Temp. Comment on any noteworthy features
All the sentences beginning with # are comments
a)
# R-code
# View some records of the dataset airquality
head(airquality)
#--output--
We can see that the required fields are present and some observations have NA
b) View an overall summary of the variables in airquality
#R-Code
#View an overall summary of the variables in airquality
summary(airquality)
#--output
6 point summary of all the variables is in the putput. Ozone has 37 observations with missing values and Solar.R has 7.
We can look at if the mean is less than or greater than the median and comment on the skewness of each of the variable. We will do that in the box plot.
c) Attach airquality to your workspace & make boxplots
#R code
#Attach airquality to your workspace
attach(airquality)
#command to plot all the plots in one window -- comment this if
you want to have separate plots
par(mfrow=c(2,2))
#make boxplots of Ozone, Solar.R, Wind, and Temp
boxplot(Ozone,main="Ozone Concentration",xlab="ozone
concentration",horizontal=TRUE)
boxplot(Solar.R,main="Solar Radiation",xlab="Solar
Radiation",horizontal=TRUE)
boxplot(Wind,main="Wind Speed",xlab="wind
speed",horizontal=TRUE)
boxplot(Temp,main="Temperature",xlab="Temperature",horizontal=TRUE)
#--output
Boxplots