# Directed Graph to Regression Help

So I have this directed graph (above)

Each arrow represents a causal link. Is it possible to calculate the affect of X on Z, where all variables are observed except U and W. If so, what would the regression equation(s) look like. I believe it has to do with 2 step least squares, but I haven't been able to figure it out. Any help/tips would be much appreciated. Thanks.

• This could be nicely modeled by a bayesian network. Look it up. – JEquihua Oct 25 '13 at 18:46
• @JEquihua I looked it up, but it didn't seem to get me anywhere. Can you tell me if you use a two stage least squares? – texastoast7 Oct 25 '13 at 19:14
• A bayesian network is exactly a model which is expresed in terms of an acyclic directed graph which represents how you think causal relationships take place between those variables (nodes). Then you put some data into that structure and study how it fits. It tries to generate a joint distribution for the complete graph for example using the EM algorithm. You say that U and W are not observed, well; a bayesian network allows you to have "latent variables" so you need not provide data for them. – JEquihua Oct 25 '13 at 19:54
• @JEquihua So would the right answer be as follows. Yes, and the unobserved variables would just be incorporated in the error term. – texastoast7 Oct 28 '13 at 0:14
• Or would it be no, since w affects both the dependent and the independent variable, there is no way to calculate the causal effect. – texastoast7 Oct 28 '13 at 0:17

In your graph, the effect of $X$ on $Z$ is unconfounded, since there are no "back-door" paths from $X$ to $Z$ (i.e. paths that have an arrow into $X$). So you will get an unbiased estimate of the effect if you simply regress $Z$ onto $X$. You can use any form of regression.

However, in one of the comments you said that "w affects both the dependent and the independent variable", so I think maybe there is a typo in the question, and you are really interested in the effect of $Y$ on $Z$ – is that the case? If so, you could use $X$ as an instrumental variable to estimate the effect of $Y$ on $Z$. I think this is why you are referring to "2 step least squares".

Instrumental variables methods usually assume the relationships between the variables are linear. There are non-linear versions but I'm less familiar with them, so here I'll assume you are dealing with a linear system. Assuming the relationships between your variables are linear, each direct causal effect can be represented with a linear coefficient. I've labeled the effects in your diagram:

You want to estimate $\beta$. This is possible, using $X$ as an instrument, because you can get unbiased estimates of the causal effect of $X$ on $Y$, and of $X$ on $Z$.

First note that the effect of $X$ on $Z$ is easy to calculate from the structural equations for $Z$ and $Y$ (where the $\varepsilon$ terms represent independent, exogenous noise):

\begin{align} Y &= \alpha X + \gamma W + \varepsilon_Y\\ \end{align}

\begin{align} Z &= \beta Y + \delta W + \phi U + \varepsilon_Z \\ &= \beta (\alpha X + \gamma W + \varepsilon_Y) + \delta W + \phi U + \varepsilon_Z \\ &= \alpha\beta X + (\beta\gamma + \delta)W + \beta\varepsilon_Y + \phi U + \varepsilon_Z \end{align}

So the effect of $X$ on $Y$ is $\alpha$, and the effect of $X$ on $Z$ is just $\alpha\beta$, the product of the two edge coefficients in the path from $X$ to $Z$.

Because the effect of $X$ on $Y$ is unconfounded, you get an unbiased estimate of $\alpha$ when you regress $Y$ on $X$. Likewise, you get an unbiased estimate of $\alpha\beta$ when you regress $Z$ on $X$. Taking the ratio of your two estimates, $\frac{\widehat{\alpha\beta}}{\hat{\alpha}}$, gives an unbiased estimate of $\beta$. So you perform two regressions to estimate one coefficient (hence the name 2-step least squares).