I have a function $f(X)$, $X$ is a function of $Y$ : $X(Y)$, Y is a function of $Z$ : $Y(Z)$ and $Z$ is a function of $\theta$: $Z(\theta)$, what is the the total derivative of $f(X)$ w.r.t to $\theta$:
$$ \frac{df(X)}{d\theta} $$
I have a function $f(X)$, $X$ is a function of $Y$ : $X(Y)$, Y is a function of $Z$ : $Y(Z)$ and $Z$ is a function of $\theta$: $Z(\theta)$, what is the the total derivative of $f(X)$ w.r.t to $\theta$:
$$ \frac{df(X)}{d\theta} $$
The chain rule can be nested as we want. In your case we have a function $f(X(Y(Z(\theta))))$ so the derivative is: $$ \frac{df}{d\theta}=\frac{df}{dX}\cdot\frac{dX}{dY}\cdot\frac{dY}{dZ}\cdot\frac{dZ}{d\theta} $$