Suppose that $X$ and $Y$ are dependent given $Z$, and independent when not given $Z$. Does this mean that:
$$ p(x,y) = p(x) \cdot p(y) \\ p(x,y|z) \neq p(x|z) \cdot p(y|z) $$
Also, are there any real-world examples of this scenario?
Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. It only takes a minute to sign up.
Sign up to join this communitySuppose that $X$ and $Y$ are dependent given $Z$, and independent when not given $Z$. Does this mean that:
$$ p(x,y) = p(x) \cdot p(y) \\ p(x,y|z) \neq p(x|z) \cdot p(y|z) $$
Also, are there any real-world examples of this scenario?
There will be many examples of the form $Z = f(X, Y)$, where $X$ and $Y$ are two independent random variables and $f$ is some function.
For example, $X$ is the number I roll on a fair die, $Y$ is the number I roll on a second fair die, and $Z$ is $X + Y$.
Yes the translation in formula is correct, up to a loose formalism.
A generic "real-world" example can be obtained when $X$ and $Y$ can have either positive association or a negative association depending on $Z$. Then $X$ and $Y$ may eventually be independent.
For instance $X$ be the income and $Y$ be the experience and $Z$ be a type of professional activity. Then $X$ and $Y$ may be positively associated for some values of $Z$ but negatively associated for some others e.g. due to technical obsolescence. Examples can occur in environmetrics when the relation between $X$ and $Y$ is subject to an "inversion": $Z$ can be the time within day, day in year, rising/falling tide...
Note that this scenario can not happen when the joint distribution of $X$, $Y$ and $Z$ is normal because the covariance of $X$ and $Y$ conditional on $Z = z$ does not depend on the value $z$. On the contrary, easy examples are found with $Z$ being discrete or multimodal.