Now the same logic, on trust in the legal system
(trstlgl). Keep the prepared ESS from Exercise
1 (its "Stuck?" box still applies).
tidy().mod <- lm_robust(trstlgl ~ eduyrs, data = ESS, weights = pspwght)
tidy(mod) # Estimate, standard error, t-value, p-value and 95% CI
# term estimate std.error statistic p.value conf.low conf.high df outcome
# 1 (Intercept) 6.135 0.287 21.4 5.2e-89 5.573 6.70 1509 trstlgl
# 2 eduyrs 0.099 0.019 5.2 2.0e-07 0.062 0.14 1509 trstlgl
Read off the estimated slope \(\hat\beta\): one more year of education goes with a change in legal-system trust of (three digits; point or comma is fine).
What is its estimated standard error \(\hat\sigma\)?
The \(t\)-value here is about 5.2. What does it tell you?
And the \(p\)-value? Which reading is correct?
Predict, then check. With \(p =\) 2e-07, at the conventional 5% threshold we …
Write two sentences (as
# comments): (a) can we reject \(H_0\), and (b) does that make the effect
causal? Then compare:
(a) Yes: p is well below 0.05, so we reject the null of no association — better-educated Danes trust the legal system significantly more. (b) No — this is a significant association in observational survey data. Significance rules out chance, not confounding: more-educated people differ in many other ways too. Causal claims need the designs we meet later in the course.
trstlgl on
eduyrs with a weighted OLS line and its 95%
confidence band, and map the weights to dot size.ggplot(ESS, aes(y = trstlgl, x = eduyrs)) +
geom_jitter(aes(size = pspwght), alpha = 1/3, height = 0.1, width = 0.1) +
geom_smooth(aes(weight = pspwght), method = "lm", color = "#901A1E") +
labs(y = "Trust in the legal system", x = "Years of education") +
theme_minimal() +
theme(legend.position = "none")
Bonus (for the fast): re-estimate the model on a
random sample of 50 respondents
(ESS %>% sample_n(50)). Is the slope still significant?
Run it a few times (without set.seed) — what does that
teach you about sample size and sampling error?
mod_small <- lm_robust(trstlgl ~ eduyrs, data = ESS %>% sample_n(50))
tidy(mod_small) %>% filter(term == "eduyrs") %>%
select(estimate, std.error, statistic, p.value)
# estimate std.error statistic p.value
# 1 0.083 0.05 1.6 0.11
With only 50 people the standard error is large, so the estimate usually is not significant — and it jumps around from run to run. The full-sample effect is real, but a tiny sample rarely has the power to detect it. More data → smaller standard error → sharper conclusions.