P. Fleer
May 23, 2017
Objective
Show effect of the “Simpson's Paradox” in multivariate regression:
Description The (purported) “Simpson's Paradox” that refers to the fact that, in multivariate (linear) regression unadjusted and adjusted effects can be the reversed. I.e. the relationship between a predictor (x1) and the outcome (y) may change when accounting for a second pedictor (x2).
Unadjusted Effect
Adjusted Effect
coefficients(lm(Fertility ~ Agriculture, data = swiss))
(Intercept) Agriculture
60.3043752 0.1942017
Unadjusted coefficient for Agriculture is positive: 0.194.
coefficients(lm(Fertility ~ Agriculture + Education, data = swiss))
(Intercept) Agriculture Education
84.08005397 -0.06647502 -0.96276262
Adjusted coefficient for Agriculture is negative: -0.066.
Swiss dataset
See for more details here.
This App was inspired by the Book Regression Models for Data Science In R by Brian Caffo, published 2015-08-05 on leanpub.
The app can be found here. —— Have fun playing!