Now the same logic, on trust in the legal system (trstlgl). Keep the prepared ESS from Exercise 1 (its "Stuck?" box still applies).

  1. Write it yourself: regress trust in the legal system on years of education, with weights, and print the full output with summary().
mod <- lm_robust(trstlgl ~ eduyrs, data = ESS, weights = pspwght)
summary(mod)
# 
# Call:
# lm_robust(formula = trstlgl ~ eduyrs, data = ESS, weights = pspwght)
# 
# Weighted, Standard error type:  HC2 
# 
# Coefficients:
#             Estimate Std. Error t value Pr(>|t|) CI Lower CI Upper   DF
# (Intercept)    6.135      0.287   21.41 5.19e-89   5.5725    6.697 1509
# eduyrs         0.099      0.019    5.22 2.01e-07   0.0618    0.136 1509
# 
# Multiple R-squared:  0.0305 , Adjusted R-squared:  0.0298 
# F-statistic: 27.3 on 1 and 1509 DF,  p-value: 2.01e-07
  1. 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).

  2. What is its estimated standard error \(\hat\sigma\)?

  3. The \(t\)-value here is about 5.2. What does it tell you?

  4. And the \(p\)-value? Which reading is correct?

  5. Predict, then check. With \(p =\) 2e-07, at the conventional 5% threshold we …

  6. 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.

  1. Visualise it: make a scatter plot of 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.043     0.054       0.8    0.43

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.