Quiz: Analysis & Inference

Week 10 · Advanced Statistical Programming using R

Recap: Reproducibility & Open Data

Q1

What is the correct sequence to set up a repo clone using renv?

  1. clone → renv::init()renv::snapshot()
  2. clone → renv::update()renv::commit()
  3. fork → renv::install()renv::push()
  4. clone → open project → renv::restore()

Answer: 4) renv::restore() installs every package at the exact version recorded in renv.lock. Opening the project triggers .Rprofile to activate the local library.

Q2

What is missing in the comment # Removed rows where age > 120 of your cleaning script?

  1. The exact timestamp of the change
  2. The reason why the cutoff is 120 and why these rows were removed
  3. The git commit hash of the edit
  4. The line number in the source data

Answer: 2) Document decisions, not just actions. The what is visible from the code; the why explains the reasoning and lets others (and future you) evaluate the choice.

Learning from Data

Q3

What are the three goals of analysis introduced in the lecture?

  1. Reading, Writing, Plotting
  2. Frequentist, Bayesian, Causal
  3. Descriptive, Explanatory, Predictive
  4. Sampling, Modelling, Testing

Answer: 3) Descriptive asks what is the state of things in the population, Explanatory is there a real relationship, Predictive how well can we predict new cases.

Q4

You spot a pattern in your data and run a t-test on the same data to check it. What is this?

  1. Confirmatory analysis
  2. Exploratory analysis
  3. Pre-registered analysis
  4. Predictive modelling

Answer: 2) The data suggested the question. So the result is a candidate finding, not a confirmed one. Label it exploratory and re-test on fresh data later.

Planning for Inference

Q5

What is the evidentiary budget?

  1. Computational resources for your project
  2. The number of variables in your dataset
  3. The pages allowed in your final report
  4. The dataset’s fixed amount of evidence

Answer: 4) Every look at the data costs some budget. This includes variables examined, patterns followed, and models tried. p-values don’t adjust for this.

Q6

A p-value is the probability of…

  1. …the null hypothesis being true
  2. …the alternative hypothesis being true
  3. …seeing a result at least this extreme, assuming H₀ is true
  4. …the effect being large

Answer: 3) The p-value lives in the world where H₀ is true. It does not tell you the probability of H₀ itself, or the size of any effect.

Q7

Why is fitting lm(y ~ x) already “doing inference”?

  1. lm() runs hypothesis tests automatically
  2. lm() only works on populations, not samples
  3. lm() requires you to state H₀ before running
  4. Regression cannot be used for description

Answer: 1) The summary() of an lm() shows a t-test for each coefficient and an F-test for the whole model. Inference is built in.

{infer}: Hypothesis Testing

Q8

What is the typical {infer} workflow for a hypothesis test?

  1. import()clean()model()predict()
  2. library()install.packages()data()summary()
  3. lm()summary()plot()predict()
  4. specify()assume()calculate()get_p_value()

Answer: 4) specify() declares variables, assume() picks the theoretical null, calculate() computes the observed statistic, get_p_value() compares them.

Q9

In {infer}, what does generate(type = "permute") do?

  1. Generates new random data points
  2. Shuffles group labels to simulate the null distribution
  3. Tests every possible model combination
  4. Creates synthetic missing values

Answer: 2) Permutation removes any real relationship between groups. Repeating it many times builds the null distribution empirically, without needing a formula.

Looking Ahead: Communication & Visualisation

Q10

Which statements about communication in data science are correct? (multiple correct answers)

  1. Strong communication amplifies the impact of analysis on decisions.
  2. A technically correct but unreadable analysis is more valuable than a clear one.
  3. Data literacy is built through practice, not just through instruction.
  4. Critical reading of visuals is a skill independent of producing them.

Answer: 1 & 3)
Correct: 1. Communication turns findings into decisions.
Correct: 3. Skills grow through practice, not just reading.
False: 2. Clarity beats correctness without readability.
False: 4. Producing and reading visuals reinforce each other.