Question
The objective of this question is to give practice building a plot that uses several optional arguments and low level functions, including a legend with
The objective of this question is to give practice building a plot that uses several optional arguments and low level functions, including a legend with mixed types of symbols.
Create overlapping relative frequency histograms for the distributions of weight split by the mother's smoker status (either smoker or non-smoker). Be sure that the plot satisifies the following criteria:
Change the x-label and main title to be more informative.
Use different colors for the two histograms. Change the density of the shading so that the overlap between the histograms is visible.
Superimpose density curves of the data, matching the color of the curves to the corresponding histogram.
Add vertical lines that show the median weights for each distribution.
Add a legend that helps understand the various colors/components of the plot.
Based on the plot, do you think there is a significant difference between the typical weight of a baby born to a mother who smokes and the typical weight of a baby born to a mother who does not smoke?
Hint: For legends with mixed types of symbols (points, lines, boxes, etc.), the pch, lty, density, and border (and other) arguments use NA to exclude those arguments from modifying the corresponding entries in the legend (fill uses 0 instead of NA). For example, a legend with two box entries and one line entry could have arguments density = c(20, 30, NA), border = c(1, 1, NA), and lty = c(NA, NA, 1).
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started