Exploratory Data Analysis complete course is currently being offered by Johns Hopkins University through Coursera platform and is being taught by Brian Caffo, Jeff Leek and Roger D. Peng

Learning Outcomes

Understand analytic graphics and the base plotting system in R

- Use advanced graphing systems such as the Lattice system

- Make graphical displays of very high dimensional data

- Apply cluster analysis techniques to locate patterns in data

Skills You Will Gain

  • Cluster Analysis
  • Ggplot2
  • R Programming
  • Exploratory Data Analysis

Also Check: How to Apply for Coursera Financial Aid


Exploratory Data Analysis Week 1 Quiz Answers - Coursera!


Exploratory Data Analysis Week 2 Quiz Answers - Coursera!

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

  • an object of class “plot”
  • an object of class “trellis”
  • an object of class “lattice”
  • nothing; only a plot is made

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.

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?

  • panel.lmline()
  • lines()
  • points()
  • axis()

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?

  • 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.

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

  • trellis.par.set()
  • splom()
  • par()
  • print.trellis()

Question 6. What is ggplot2 an implementation of?

  • 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

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
    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”)

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

  • 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

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?

  • 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.

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()

Alternate Question

1. 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()

Post a Comment

Previous Post Next Post