# Problem 4.15 Additive Noise Models (ANMs)

## a) ANM I

Given the SCM
\begin{align}
X:=&N_X\\
Y:=&2X+N_Y
\end{align}
with $N_X\sim U(1,3)$ and $N_Y\sim U(-0.5,0.5)$.

### Support of $P_{X,Y}$


```python
%matplotlib inline
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
```


```python
n = 3000
x = np.random.uniform(1, 3, n)
y = 2 * x + np.random.uniform(-.5, .5, n)
```


```python
def plot_support(x, y):
    fig = plt.figure()
    ax=fig.add_axes([0, 0, 2, 2])
    ax.scatter(x, y, color='b')
    ax.set_xlabel('$X$')
    ax.set_ylabel('$Y$')
    ax.set_title('$P_{X,Y}$')
    plt.show()
```


```python
plot_support(x, y)
```

There is no ANM from $Y$ to $X$ because the noise shape depends on $Y$, when the plot _is flipped by 90 degrees_.

## b) ANM II

ANM with the same noise as ANM I, but the causal assignments
\begin{align}
X:=&N_X\\
Y:=&X^2+N_Y
\end{align}


```python
x = np.random.uniform(1, 3, n)
y = x**3 + np.random.uniform(-.5, .5, n)
```


```python
plot_support(x, y)
```

Visually, the thickness seems to vary because me measure orthogonal to the tangent. However, as seen from the $X$ axis, the thickness remains the same.

Again, the height of the _noise bar_ in $Y$ direction is always the same regardless of $X$. When flipping the plot, i.e. changing the causal direction, the noise thickness depends on $Y$.

b15cbf800cf22c33ce9435c8e5d3e16bbf3f906d
ipynb
Jupyter Notebook
causal-inference/problems/problem-4.15-anms.ipynb
Simsso/Machine-Learning-Tinkering
0a024aab0bb1ac5fbdd2f77380ab36d192278701
MIT
2020-02-19T16:30:04.000Z
2020-03-13T02:22:29.000Z
causal-inference/problems/problem-4.15-anms.ipynb
Simsso/Machine-Learning-Tinkering
0a024aab0bb1ac5fbdd2f77380ab36d192278701
MIT
2021-02-17T14:00:33.000Z
2022-02-10T03:05:35.000Z
causal-inference/problems/problem-4.15-anms.ipynb
Simsso/Machine-Learning-Tinkering
0a024aab0bb1ac5fbdd2f77380ab36d192278701
MIT
Qwen/Qwen-72B
1. YES
2. YES