You create a scatterplot of two variables and observe that the cloud of points trends downward from left to right: as the x-axis variable increases, the points tend to sit lower on the y-axis. What does this pattern suggest about the relationship between the two variables?
- Wrong: a lack of association would show a shapeless cloud with no consistent up or down trend.
- Correct: a downward-trending cloud indicates a negative (inverse) association between the two variables.
- Wrong: a positive association would show the cloud trending upward, not downward.
- Wrong: a trend alone doesn’t imply a perfect relationship; the points could still show substantial scatter around it.
You call barplot() on a two-way contingency table without setting any additional arguments, and the resulting figure stacks each group’s bar on top of another. Which argument should you change to instead display the bars for each group side by side?
- Wrong:
horizonly flips the bars from vertical to horizontal; it doesn’t change stacking versus grouping. - Wrong:
probabilityis ahist()argument for switching to a density scale, and has no effect on bar arrangement. - Wrong:
legendonly controls whether a legend is drawn; it does not change how the bars are arranged. - Correct: setting
beside = TRUEplaces the bars for each group next to each other instead of stacking them.
You’ve already created a histogram and now want to add a kernel density curve on top of it, in the same figure. What happens if you call plot() on the density estimate to try to add it?
- Correct:
plot()always draws a fresh figure; to add a layer to an existing plot, a dedicated layering function likelines()is needed instead. - Wrong: this doesn’t produce an error; it silently replaces the existing plot with a new one.
- Wrong:
plot()starts a new plot rather than drawing on top of an existing one. - Wrong:
plot()can accept a density object; it just doesn’t layer it onto an existing figure.
Recall the conditional boxplot from the tutorial, created with boxplot(progress ~ sex, data = diabetes). Suppose that, instead of looking similar, the box for one sex group sat entirely above the box for the other, with little to no overlap between the two boxes. What would this suggest?
- Wrong: a lack of relationship would show similarly positioned, overlapping boxes for both groups.
- Wrong: a difference between groups on a boxplot reflects a pattern in the data, not a measurement error.
- Correct: boxes that don’t overlap indicate a clear separation between the two groups’ central values.
- Wrong: identical distributions would produce boxes that overlap closely, not boxes with a clear separation.