Online Courses Support

Exploratory Data Analysis Answer

Exploratory Data Analysis Answer Of Coursera Quiz. In this post you will get Correct Quiz & Assignment Answer of Exploratory Data Analysis

 

Exploratory Data Analysis Answer

Offered By ”Johns Hopkins University”

Enroll Now

N.B. We attempted our best to keep this site refreshed for our clients for nothing. You can likewise contribute by refreshing new inquiries or existing inquiry answer(s). There are numerous inquiries on our site, it is difficult for us to check them consistently. It will be extraordinary on the off chance that you can assist us with updating the site. Just let us know if you find any new questions through mail or comment . We will attempt to refresh the inquiry/answer ASAP.

 

Week 1 Quiz

 

1.
Question 1
Which of the following is a principle of analytic graphics?

1 point

  • Show box plots (univariate summaries)
  • Only do what your tools allow you to do
  • Show causality, mechanism, explanation
  • Make judicious use of color in your scatterplots
  • Don’t plot more than two variables at at time

 

1.

Which of the following is a principle of analytic graphics?

Make judicious use of color in your scatterplots (NO)

Don’t plot more than two variables at at time (NO)

Show box plots (univariate summaries) (NO)

Only do what your tools allow you to do (NO)

Show comparisons

 

2.
Question 2
What is the role of exploratory graphs in data analysis?

1 point

  • Axes, legends, and other details are clean and exactly detailed.
  • They are typically made very quickly.
  • Only a few are constructed.
  • They are made for formal presentations.

3.
Question 3
Which of the following is true about the base plotting system?

1 point

  • The system is most useful for conditioning plots
  • Plots are created and annotated with separate functions
  • Plots are typically created with a single function call
  • Margins and spacings are adjusted automatically depending on the type of plot and the data

4.
Question 4
Which of the following is an example of a valid graphics device in R?

1 point

  • The keyboard
  • A file folder
  • A Microsoft Word document
  • A PNG file
  • A socket connection

 

4.

Which of the following is an example of a valid graphics device in R?

A file folder (NO)

The computer screen

A Microsoft Word document (NO)

A socket connection (NO)

The keyboard (NO)

 

5.
Question 5
Which of the following is an example of a vector graphics device in R?

1 point

  • TIFF
  • GIF
  • Postscript
  • PNG
  • JPEG

5.

Which of the following is an example of a vector graphics device in R?

GIF

TIFF

SVG

PNG

JPEG

 

6.
Question 6
Bitmapped file formats can be most useful for

1 point

  • Scatterplots with many many points
  • Plots that require animation or interactivity
  • Plots that are not scaled to a specific resolution
  • Plots that may need to be resized

7.
Question 7
Which of the following functions is typically used to add elements to a plot in the base graphics system?

1 point

  • hist()
  • boxplot()
  • plot()
  • text()

 

7.

Which of the following functions is typically used to add elements to a plot in the base graphics system?

hist()

plot()

points()

boxplot()

 

8.
Question 8
Which function opens the screen graphics device for the Mac?

1 point

  • quartz()
  • bitmap()
  • pdf()
  • png()

 

8.

Which function opens the screen graphics device on Windows?

postscript()

windows()

jpeg()

xfig()

 

 

9.
Question 9
What does the ‘pch’ option to par() control?

1 point

  • the plotting symbol/character in the base graphics system
  • the line width in the base graphics system
  • the orientation of the axis labels on the plot
  • the size of the plotting symbol in a scatterplot

 

9. What does the ‘pch’ option to par() control?

  • the size of the plotting symbol in a scatterplot
  • the plotting symbol/character in the base graphics system
  • the orientation of the axis labels on the plot
  • the line width in the base graphics system

 

10.
Question 10
If I want to save a plot to a PDF file, which of the following is a correct way of doing that?

1 point

  • Construct the plot on the screen device and then copy it to a PDF file with dev.copy2pdf()
  • Construct the plot on the PNG device with png(), then copy it to a PDF with dev.copy2pdf().
  • Open the screen device with quartz(), construct the plot, and then close the device with dev.off().
  • Open the PostScript device with postscript(), construct the plot, then close the device with dev.off().

 

 

Peer-graded Assignment: Course Project 1

Week 1 Assignment :

https://github.com/a-tagliente/ExData_Plotting1

 

 

Week– 2

1.
Question 1
Under the lattice graphics system, what do the primary plotting functions like xyplot() and bwplot() return?

1 point

an object of class “plot”

an object of class “trellis”

an object of class “lattice”

nothing; only a plot is made

2.
Question 2
What is produced by the following code?

123
library(nlme)
library(lattice)
xyplot(weight ~ Time | Diet, BodyWeight)
1 point

A set of 16 panels showing the relationship between weight and time for each rat.

A set of 11 panels showing the relationship between weight and diet for each time.

A set of 3 panels showing the relationship between weight and time for each rat.

A set of 3 panels showing the relationship between weight and time for each diet.

3.
Question 3
Annotation of plots in any plotting system involves adding points, lines, or text to the plot, in addition to customizing axis labels or adding titles. Different plotting systems have different sets of functions for annotating plots in this way.

Which of the following functions can be used to annotate the panels in a multi-panel lattice plot?

1 point

panel.lmline()

lines()

points()

axis()

 

3. Annotation of plots in any plotting system involves adding points, lines, or text to the plot, in addition to customizing axis labels or adding titles. Different plotting systems have different sets of functions for annotating plots in this way.

Which of the following functions can be used to annotate the panels in a multi-panel lattice plot?

axis()

text()

panel.abline()

points()

lines()

 

4.
Question 4
The following code does NOT result in a plot appearing on the screen device.

1234
library(lattice)
library(datasets)
data(airquality)
p <- xyplot(Ozone ~ Wind | factor(Month), data = airquality)
Which of the following is an explanation for why no plot appears?

1 point

The object ‘p’ has not yet been printed with the appropriate print method.

There is a syntax error in the call to xyplot().

The variables being plotted are not found in that dataset.

The xyplot() function, by default, sends plots to the PDF device.

5.
Question 5
In the lattice system, which of the following functions can be used to finely control the appearance of all lattice plots?

1 point

trellis.par.set()

splom()

par()

print.trellis()

6.
Question 6
What is ggplot2 an implementation of?

1 point

a 3D visualization system

the S language originally developed by Bell Labs

the base plotting system in R

the Grammar of Graphics developed by Leland Wilkinson

7.
Question 7
Load the `airquality’ dataset form the datasets package in R

12
library(datasets)
data(airquality)
I am interested in examining how the relationship between ozone and wind speed varies across each month. What would be the appropriate code to visualize that using ggplot2?

1 point

1
qplot(Wind, Ozone, data = airquality, facets = . ~ factor(Month))

1
qplot(Wind, Ozone, data = airquality)

12
airquality = transform(airquality, Month = factor(Month))
qplot(Wind, Ozone, data = airquality, facets = . ~ Month)

1
qplot(Wind, Ozone, data = airquality, geom = “smooth”)

 

8.
Question 8
What is a geom in the ggplot2 system?

1 point

a method for mapping data to attributes like color and size

a statistical transformation

a method for making conditioning plots

a plotting object like point, line, or other shape

9.
Question 9
When I run the following code I get an error:

1234
library(ggplot2)
library(ggplot2movies)
g <- ggplot(movies, aes(votes, rating))
print(g)
I was expecting a scatterplot of ‘votes’ and ‘rating’ to appear. What’s the problem?

1 point

The object ‘g’ does not have a print method.

The dataset is too large and hence cannot be plotted to the screen.

There is a syntax error in the call to ggplot.

ggplot does not yet know what type of layer to add to the plot.

10.
Question 10
The following code creates a scatterplot of ‘votes’ and ‘rating’ from the movies dataset in the ggplot2 package. After loading the ggplot2 package with the library() function, I can run

1
qplot(votes, rating, data = movies)
How can I modify the the code above to add a smoother to the scatterplot?

1 point

 

qplot(votes, rating, data = movies) + geom_smooth()

 

 

 

 

Week- 4

Peer-graded Assignment: Course Project 2

 

 

 

 

1.

 

 

PROMPT
Copy and paste the R code file for the plot uploaded in the previous question.

# libraries
require(utils)
require(cairoDevice) # anti-aliasing figure
# download, load data and subset
fileUrl <-
‘https://d396qusza40orc.cloudfront.net/exdata%2Fdata
%2FNEI_data.zip’
download.file(fileUrl,
destfile = ‘./Data.zip’,
method = ‘curl’, quiet = T)
if(file.exists(‘./Data.zip’)) {
# Extract data file
unzip(‘./Data.zip’)
# Delete original Zip file if it exists
invisible(file.remove(‘./Data.zip’))
}
## This first line will likely take a few seconds. Be
patient!
NEI <- readRDS(“summarySCC_PM25.rds”)
SCC <- readRDS(“Source_Classification_Code.rds”)
# Delete data files .rds
if(all(file.exists(‘./summarySCC_PM25.rds’,
‘Source_Classification_Code.rds’))) {
invisible(file.remove(‘./summarySCC_PM25.rds’,
‘Source_Classification_Code.rds’))
}
# Create the png
png(‘./plot1.png’, width = 500, height = 450,
res = 55, type = ‘cairo’) # default is 480px X 480px
# Make Plot
with(aggregate(Emissions ~ year, NEI, sum),
plot(Emissions~year, pch = 18,
xlab = ”, ylab = ‘Total PM2.5 Emissions (tons)’,
main = ‘Total PM2.5 Emissions by Year’,
col = “blue”, type = “b”, xlim = c(1999, 2008),
lty = 2, lwd = 1.5, lab = c(10, 5, 7)))
# Close png file
dev.off()

 

 

2.

 

 

 

PROMPT

Copy and paste the R code file for the plot uploaded in the previous question.

# libraries
require(utils)
require(cairoDevice) # anti-aliasing figure
# download, load data and subset
fileUrl <-
‘https://d396qusza40orc.cloudfront.net/exdata%2Fdata
%2FNEI_data.zip’
download.file(fileUrl,
destfile = ‘./Data.zip’,
method = ‘curl’, quiet = T)
if(file.exists(‘./Data.zip’)) {
# Extract data file
unzip(‘./Data.zip’)
# Delete original Zip file if it exists
invisible(file.remove(‘./Data.zip’))
}
## This first line will likely take a few seconds. Be
patient!
NEI <- readRDS(“summarySCC_PM25.rds”)
SCC <- readRDS(“Source_Classification_Code.rds”)
# Delete data files .rds
if(all(file.exists(‘./summarySCC_PM25.rds’,
‘Source_Classification_Code.rds’))) {
invisible(file.remove(‘./summarySCC_PM25.rds’,
‘Source_Classification_Code.rds’))) {
invisible(file.remove(‘./summarySCC_PM25.rds’,
‘Source_Classification_Code.rds’))
}
# Create the png
png(‘./plot2.png’, width = 500, height = 450,
res = 55, type = ‘cairo’) # default is 480px X 480px
# subset data
NEI_Baltimore <- subset(NEI, fips == “24510”)
# Make Plot
with(aggregate(Emissions ~ year, NEI_Baltimore, sum),
plot(Emissions~year, pch = 18,
xlab = ”, ylab = ‘Total PM2.5 Emissions (tons)’,
main = ‘Total PM2.5 Emissions by Year in Baltimore City’,
col = “blue”, type = “b”, xlim = c(1999, 2008),
lty = 2, lwd = 1.5, lab = c(10, 5, 7)))
# Close png file
dev.off()

 

3.

 

 

 

PROMPT

Copy and paste the R code file for the plot uploaded in the previous question.

# libraries
require(utils)
require(cairoDevice) # anti-aliasing figure
# download, load data and subset
fileUrl <-
‘https://d396qusza40orc.cloudfront.net/exdata%2Fdata
%2FNEI_data.zip’
download.file(fileUrl,
destfile = ‘./Data.zip’,
method = ‘curl’, quiet = T)
if(file.exists(‘./Data.zip’)) {
# Extract data file
unzip(‘./Data.zip’)
# Delete original Zip file if it exists
invisible(file.remove(‘./Data.zip’))
}
## This first line will likely take a few seconds. Be
patient!
NEI <- readRDS(“summarySCC_PM25.rds”)
SCC <- readRDS(“Source_Classification_Code.rds”)
# Delete data files .rds
if(all(file.exists(‘./summarySCC_PM25.rds’,
‘Source_Classification_Code.rds’))) {
invisible(file.remove(‘./summarySCC_PM25.rds’,
‘Source_Classification_Code.rds’))
}
# Create the png
png(‘./plot3.png’, width = 700, height = 370,
res = 75, type = ‘cairo’) # default is 480px X 480px
# subset data
NEI_Baltimore <- subset(NEI, fips == “24510”)
# Make Plot
NEI_Baltimore %>%
group_by(year, type) %>%
summarise(sum = sum(Emissions)) %>%
ggplot(aes(year, sum)) +
geom_point() + geom_line() +
facet_wrap(~type, ncol = 4) +
labs(title = ‘Total PM2.5 Emission by Year in Baltimore
City’,
subtitle = ‘Subsetted by Type of Source’) +
xlab(”) + ylab(‘Total PM2.5 Emission (tons)’) +
scale_x_continuous(breaks =
unique(NEI_Baltimore$year)) +
theme_bw()
# Close png file
dev.off()

 

 

4.

 

 

PROMPT

Copy and paste the R code file for the plot uploaded in the previous question.

# libraries
require(utils)
require(cairoDevice) # anti-aliasing figure
# download, load data and subset
fileUrl <-
‘https://d396qusza40orc.cloudfront.net/exdata%2Fdata
%2FNEI_data.zip’
download.file(fileUrl,
destfile = ‘./Data.zip’,
method = ‘curl’, quiet = T)
if(file.exists(‘./Data.zip’)) {
# Extract data file
unzip(‘./Data.zip’)
# Delete original Zip file if it exists
invisible(file.remove(‘./Data.zip’))
}
## This first line will likely take a few seconds. Be
patient!
NEI <- readRDS(“summarySCC_PM25.rds”)
SCC <- readRDS(“Source_Classification_Code.rds”)
# Delete data files .rds
if(all(file.exists(‘./summarySCC_PM25.rds’,
‘Source_Classification_Code.rds’))) {
invisible(file.remove(‘./summarySCC_PM25.rds’,
‘Source_Classification_Code.rds’))) {
invisible(file.remove(‘./summarySCC_PM25.rds’,
‘Source_Classification_Code.rds’))
}
# Create the png
png(‘./plot4.png’, width = 700, height = 370,
res = 75, type = ‘cairo’) # default is 480px X 480px
# merge data and make Plot
NEI %>%
inner_join(SCC, by = ‘SCC’) %>%
dplyr::filter(str_detect(Short.Name, ‘[Cc]oal’)) %>%
group_by(year, type) %>%
summarise(sum = sum(Emissions)) %>%
ggplot(aes(year, sum)) +
geom_point() + geom_line() +
facet_wrap(~type, ncol = 4) +
labs(title = ‘Total PM2.5 Coal Emission by Year’,
subtitle = ‘Subsetted by Type of Source’) +
xlab(”) + ylab(‘Total PM2.5 Emission (tons)’) +
scale_x_continuous(breaks = unique(NEI$year)) +
theme_bw()
# Close png file
dev.off()

 

5.

 

 

PROMPT
Copy and paste the R code file for the plot uploaded in the previous question.

# libraries
require(utils)
require(cairoDevice) # anti-aliasing figure
# download, load data and subset
fileUrl <-
‘https://d396qusza40orc.cloudfront.net/exdata%2Fdata
%2FNEI_data.zip’
download.file(fileUrl,
destfile = ‘./Data.zip’,
method = ‘curl’, quiet = T)
if(file.exists(‘./Data.zip’)) {
# Extract data file
unzip(‘./Data.zip’)
# Delete original Zip file if it exists
invisible(file.remove(‘./Data.zip’))
}
## This first line will likely take a few seconds. Be
patient!
NEI <- readRDS(“summarySCC_PM25.rds”)
SCC <- readRDS(“Source_Classification_Code.rds”)
# Delete data files .rds
if(all(file.exists(‘./summarySCC_PM25.rds’,
‘Source_Classification_Code.rds’))) {
invisible(file.remove(‘./summarySCC_PM25.rds’,
‘Source_Classification_Code.rds’))
}
# Create the png
png(‘./plot5.png’, width = 700, height = 370,
res = 75, type = ‘cairo’) # default is 480px X 480px
# Make Plot
NEI %>%
dplyr::filter(fips == ‘24510’,
type == ‘ON-ROAD’) %>%
group_by(year) %>%
summarise(sum = sum(Emissions)) %>%
ggplot(aes(year, sum)) +
geom_point() + geom_line() +
labs(title = ‘Total PM2.5 Emission by Year in Baltimore
City’,
subtitle = ‘Subsetted from Motor Vehicle Sources (“On-
Road type”)’) +
xlab(”) + ylab(‘Total PM2.5 Emission (tons)’) +
scale_x_continuous(breaks = unique(NEI$year)) +
theme_bw()
# Close png file
dev.off()

 

6.

 

 

PROMPT
Copy and paste the R code file for the plot uploaded in the previous question.

# libraries
require(utils)
require(cairoDevice) # anti-aliasing figure
# download, load data and subset
fileUrl <-
‘https://d396qusza40orc.cloudfront.net/exdata%2Fdata
%2FNEI_data.zip’
download.file(fileUrl,
destfile = ‘./Data.zip’,
method = ‘curl’, quiet = T)
if(file.exists(‘./Data.zip’)) {
# Extract data file
unzip(‘./Data.zip’)
# Delete original Zip file if it exists
invisible(file.remove(‘./Data.zip’))
}
## This first line will likely take a few seconds. Be
patient!
NEI <- readRDS(“summarySCC_PM25.rds”)
SCC <- readRDS(“Source_Classification_Code.rds”)
# Delete data files .rds
if(all(file.exists(‘./summarySCC_PM25.rds’,
‘Source_Classification_Code.rds’))) {
invisible(file.remove(‘./summarySCC PM25.rds’
‘Source_Classification_Code.rds’))
}
# Create the png
png(‘./plot6.png’, width = 700, height = 370,
res = 75, type = ‘cairo’) # default is 480px X 480px
# Make Plot
NEI %>%
dplyr::filter(fips %in% c(“24510”, “06037”),
type == ‘ON-ROAD’) %>%
group_by(year, fips) %>%
summarise(sum = sum(Emissions)) %>%
ggplot(aes(year, sum, col = fips)) +
geom_point() + geom_line() +
labs(title = ‘Total PM2.5 Emission by Year in Baltimore
and Los Angeles’,
subtitle = ‘Subsetted from Motor Vehicle Sources (“On-
Road type”)’) +
xlab(”) + ylab(‘Total PM2.5 Emission (tons)’) +
scale_colour_discrete(name = “City”, labels = c(“Los
Angeles”, “Baltimore”)) +
theme(legend.title = element_text(face = “bold”)) +
scale_x_continuous(breaks = unique(NEI$year)) +
theme_bw()
# Close png file
dev.off()

Similar Posts