I just tried to create all these in R on purpose. (make up 100 observations with x1 and x2 with some random errors, with different relationship between x1 and x2) Then you try to analyze with LM function. I think this is a great way to play with and learn the concept. Good "lab" material I think.
If you look at the diagram for confounding, X1 is on the pathway between x2 and y. Can we say that x1 is a mediator in the x2 and y relationship while x2 is a confounder in the x1 and y relationship?
I just tried to create all these in R on purpose. (make up 100 observations with x1 and x2 with some random errors, with different relationship between x1 and x2) Then you try to analyze with LM function. I think this is a great way to play with and learn the concept. Good "lab" material I think.
If you look at the diagram for confounding, X1 is on the pathway between x2 and y. Can we say that x1 is a mediator in the x2 and y relationship while x2 is a confounder in the x1 and y relationship?
Yes, it can be inferred in this way as well.
but if one was creating a predictor model rather than a model to measure the effect of X1 then should a mediator be included ?
Great summary!