Week 10 · Advanced Statistical Programming using R
What is the correct sequence to set up a repo clone using renv?
renv::init() → renv::snapshot()renv::update() → renv::commit()renv::install() → renv::push()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.
What is missing in the comment # Removed rows where age > 120 of your cleaning script?
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.
What are the three goals of analysis introduced in the lecture?
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.
You spot a pattern in your data and run a t-test on the same data to check it. What is this?
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.
What is the evidentiary budget?
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.
A p-value is the probability of…
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.
Why is fitting lm(y ~ x) already “doing inference”?
lm() runs hypothesis tests automaticallylm() only works on populations, not sampleslm() requires you to state H₀ before runningAnswer: 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 TestingWhat is the typical {infer} workflow for a hypothesis test?
import() → clean() → model() → predict()library() → install.packages() → data() → summary()lm() → summary() → plot() → predict()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.
In {infer}, what does generate(type = "permute") do?
Answer: 2) Permutation removes any real relationship between groups. Repeating it many times builds the null distribution empirically, without needing a formula.
Which statements about communication in data science are correct? (multiple correct answers)
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.