Quiz: Analysis & Inference

Week 11 · Advanced Statistical Programming using R

Recap: Analysis & Inference

Q1

When do you actually need an inference plan (rather than just a general data analysis plan)?

  1. When importing CSV files
  2. When cleaning data
  3. When visualising distributions
  4. When making claims that go beyond the data you have

Answer: 4) Description, cleaning, and visualisation don’t require it. An inference plan matters when you generalise from a sample to a population.

Q2

You train a predictive model and report 92% accuracy on the same data you trained it on. What is the problem?

  1. 92% is too low to publish
  2. You need to convert it to a percentage
  3. Training accuracy overstates how well the model predicts new data
  4. R cannot calculate accuracy

Answer: 3) The model has already seen these answers. Use held-out data or cross-validation to estimate true prediction accuracy.

Communicating with Data

Q3

You want to communicate a trend. Should you use a table or a plot?

  1. Always whichever is shorter
  2. A plot, because patterns and trends are easier to see visually
  3. Neither, write the result in prose
  4. Always a table, they fit more values

Answer: 2) Tables are best for exact values or small comparisons. Plots win for patterns, trends, and messages.

Making tables with {gt}

Q4

What is the typical {gt} workflow for a polished table?

  1. gt()fmt_number()cols_label()tab_header()
  2. gt()lm()summary()plot()
  3. tibble()print()kable()gt()
  4. read_csv()gt()save()quit()

Answer: 1) Start with gt(), then stack formatting (fmt_*), column (cols_*), and annotation (tab_*) layers one at a time.

Q5

Which are good design rules for tables? (multiple correct answers)

  1. Right-align numbers, left-align text
  2. Use a different font for every column
  3. Put units in column headers, not in every cell
  4. Choose decimal places deliberately for the precision that matters

Answer: 1, 3 & 4)
Correct: 1. Number alignment makes columns scannable.
Correct: 3. Units belong in headers to keep cells clean.
Correct: 4. Decimal places signal real precision, not noise.
False: 2. Mixed fonts add clutter without clarity.

Visualisation Principles

Q6

Which chart type best compares values across categories?

  1. Histogram
  2. Scatter plot
  3. Bar chart
  4. Density plot

Answer: 3) Bar charts compare values across categories. Histograms and density plots show distributions; scatter plots show relationships between two variables.

Q7

According to Cleveland & McGill (1984), which visual encoding lets people compare values most accurately?

  1. Colour saturation
  2. Area (e.g. bubble size)
  3. Length (e.g. bar height)
  4. Position along a common scale

Answer: 4) Position is the most precise encoding. Length, angle, area, and colour follow in decreasing accuracy. A useful audit lens for any chart.

Q8

What is the main purpose of direct labelling (e.g. ggrepel::geom_text_repel())?

  1. To make plots look more colourful
  2. To reduce eye-travel between data points and legend
  3. To remove all text from a plot
  4. To convert ggplot output into a gt table

Answer: 2) Placing labels directly on the data removes the back-and-forth between legend and chart. Best for five groups or fewer.

Q9

According to the lecture, what should good alt text for a chart do?

  1. Duplicate the caption word for word
  2. List every data point in the plot
  3. Complement the caption by stating chart type, variables, and observable patterns
  4. Only describe the colours used

Answer: 3) Alt text and caption together give complete understanding. If the caption states the insight, alt text focuses on structure: chart type, variables, units, and patterns per group.

Looking Ahead: Interactive Data Storytelling

Q10

Which feature distinguishes an interactive chart from a static one?

  1. It always renders faster than a static plot
  2. It lets readers filter, zoom, or hover for details
  3. It works without an internet connection
  4. It removes the need for axis labels

Answer: 2) Static charts tell one story. Interactive charts let readers ask their own questions of the data, useful for dashboards and explainers.