Week 11 · Advanced Statistical Programming using R
When do you actually need an inference plan (rather than just a general data analysis plan)?
Answer: 4) Description, cleaning, and visualisation don’t require it. An inference plan matters when you generalise from a sample to a population.
You train a predictive model and report 92% accuracy on the same data you trained it on. What is the problem?
Answer: 3) The model has already seen these answers. Use held-out data or cross-validation to estimate true prediction accuracy.
You want to communicate a trend. Should you use a table or a plot?
Answer: 2) Tables are best for exact values or small comparisons. Plots win for patterns, trends, and messages.
{gt}What is the typical {gt} workflow for a polished table?
gt() → fmt_number() → cols_label() → tab_header()gt() → lm() → summary() → plot()tibble() → print() → kable() → gt()read_csv() → gt() → save() → quit()Answer: 1) Start with gt(), then stack formatting (fmt_*), column (cols_*), and annotation (tab_*) layers one at a time.
Which are good design rules for tables? (multiple correct answers)
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.
Which chart type best compares values across categories?
Answer: 3) Bar charts compare values across categories. Histograms and density plots show distributions; scatter plots show relationships between two variables.
According to Cleveland & McGill (1984), which visual encoding lets people compare values most accurately?
Answer: 4) Position is the most precise encoding. Length, angle, area, and colour follow in decreasing accuracy. A useful audit lens for any chart.
What is the main purpose of direct labelling (e.g. ggrepel::geom_text_repel())?
gt tableAnswer: 2) Placing labels directly on the data removes the back-and-forth between legend and chart. Best for five groups or fewer.
According to the lecture, what should good alt text for a chart do?
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.
Which feature distinguishes an interactive chart from a static one?
Answer: 2) Static charts tell one story. Interactive charts let readers ask their own questions of the data, useful for dashboards and explainers.