Drill 4: when an assumption fails
A check has come back with a problem. Name the assumption, say whether it matters, and pick the remedy, with what it changes.
What runs in CodeSplash
- Two-sample t-test (Welch / Student, or z test) Verified in Python and R
- Exact test of independence for R × C tables (Fisher–Freeman–Halton) Verified in Python and R
- Repeated-measures ANOVA (one within factor) Verified in Python and R
- Linear regression (OLS) Verified in Python and R
- Cox proportional hazards regression Verified in Python and R
- Cox model with time-varying covariates (start–stop data) Verified in Python and R
- Count regression (Poisson / negative binomial) Verified in Python and R
- Linear mixed model (random intercepts and slopes) Verified in Python and R
- Friedman test (repeated measures, ranks) Verified in Python and R
You will be able to
- Judge whether a failed check matters at this sample size
- Pick the standard remedy for common failures
- State what the remedy changes
Read first
Three questions, every time
ReadWhen a row turns amber or red, ask in order:
- What does it threaten? The estimate, or only its standard error?
- How bad is it, at this sample size? Read the plot, not only the p-value.
- What is the smallest remedy that fixes it? And what does that remedy change?
Many remedies only fix the standard error, and leave the estimand alone. Those are the cheap ones, so try them first.
Round one
CheckpointCheck yourself
Two groups, = 12 and 60. The small group has three times the spread. You planned Student's t. What should you do?
Show the answer
Answer: a
Student's test can be badly off when variances and sizes differ together, especially when the small group is the noisy one. Welch fixes this at almost no cost.
Check yourself
A 2×2 table has an expected count of 2.1. What should you do?
Show the answer
Answer: b
Small expected counts break the approximation, not the question. An exact test answers the same question without it.
Check yourself
Repeated-measures ANOVA with four time points. Mauchly's test flags sphericity, and ε is well below 1. What should you do?
Show the answer
Answer: a
The correction lowers the degrees of freedom to reflect unequal variance of differences. A mixed model can represent the covariance directly.
Check yourself
In a linear regression, the residuals fan out as fitted values rise. You care about the coefficient on price. Which is the smallest remedy?
Show the answer
Answer: b
Heteroskedasticity mainly damages standard errors, so HC3 fixes those and leaves the estimate alone. A log outcome changes the interpretation to percentages.
Round two
CheckpointCheck yourself
A Cox model. Schoenfeld residuals show treatment's hazard ratio changes over time. What should you do?
Show the answer
Answer: b
Non-proportional hazards change what a single hazard ratio means. These remedies change what you are estimating, so state it.
Check yourself
Daily sales regression. Durbin–Watson flags positive autocorrelation in the residuals. What should you do?
Show the answer
Answer: b
Autocorrelated errors make ordinary standard errors too small. Shuffling destroys the time structure and hides the problem.
Check yourself
A Poisson model's variance is much larger than its mean. What should you do?
Show the answer
Answer: b
Overdispersion means Poisson standard errors are too small. A negative binomial adds a dispersion parameter and keeps the rate-ratio meaning.
Check yourself
in each group. Shapiro–Wilk rejects, and the Q–Q plot shows a slight S-curve. You are comparing means. What should you do?
Show the answer
Answer: c
The check is too powerful at this size. Means don't need normal data in large samples, and switching would change your estimand for no gain.
The one that can't be repaired
PredictPredict first
An outcome was measured only on patients who survived to the end of a study, and the survivors differ by treatment. Which remedy helps?
Reveal
Neither fixes this. Selection on survival isn't a violation that a technique can repair, because it changes who you are comparing. It is a design problem: go back to the question, consider a method for truncation by death, and talk to a statistician.
Practice on a card
In the appFit a regression with diagnostics set to full on one of your datasets. For each amber or red row, answer the three questions before you open its remedies. Then run one remedy and read its badge.
Recap
Recap- Ask what it threatens, how bad it is, and what the smallest fix is.
- Many fixes only change the standard error, so start there.
- Some problems come from the design, and no technique can repair them.
Concepts in this lesson