Causality, Causal Inference, Backdoor, Frontdoor, Instrumental Variable.
a[2]*bd x <- ifelse(x<=median(x), 0, 1) lm(x~iv + bd) %>% summary fd <- (rnorm(n, sd = sd_noise) + a[3]*x ) lm(fd ~ x) %>% summary() y <- (65 + rnorm(n, sd = sd_noise) + a[4]*fd + a[5]*bd ) lm(y ~ fd + bd) %>% summary() id <- rnorm(n) df <- data.frame( id = id, x = x, y = y, iv = iv, fd = fd, bd =