How to factor random variables that involve conditionals on hyper-parameters? Suppose we have a Bayesian DAG with the following structure:
\begin{array}{c} \alpha & & \beta & & \gamma & & \delta\\ & \searrow & \downarrow && \downarrow &\swarrow \\ && p && q\\ && \searrow && \swarrow\\ &&& x\end{array}
where $\alpha, \beta, \gamma, \delta$ are hyper-parameters. I am wondering how to formally prove that:
$$
f(x, p,q\mid \alpha,\beta,\gamma,\delta) = f(x\mid p,q)\,f(p,q\mid \alpha,\beta,\gamma,\delta)
$$
I tried to factor the right hand side using Bayes' Theorem with:
$$
f(x\mid p,q)\,f(p,q\mid \alpha,\beta,\gamma,\delta) = \frac{f(x,p,q)}{f(p,q)}\frac{f(p,q,\alpha,\beta,\gamma,\delta)}{f(\alpha,\beta,\gamma,\delta)}
$$
but something is wrong here and I suspect it is notational abuse with hyper parameters? In other words, $f(\alpha,\beta,\gamma,\delta)$ is a distribution on parameters. How does this work? Are they point masses?Does anyone know of a rigorous way to show the above? It doesn't seem right somehow. 
 A: The directed acyclical graph that represents your structure is what leads to your result here. The structure says that the joint probability function can be factored as follows
$$
f(x, p, q, \alpha, \beta, \gamma, \delta) = f(x | p, q) f(p, q | \alpha, \beta, \gamma, \delta) f(\alpha, \beta, \gamma, \delta)
$$
as a result, you have
$$
f(x, p, q | \alpha, \beta, \gamma, \delta) = \frac{f(x, p, q, \alpha, \beta, \gamma, \delta)}{f(\alpha, \beta, \gamma, \delta)} = 
$$
$$
= \frac{f(x | p, q) f(p, q | \alpha, \beta, \gamma, \delta) f(\alpha, \beta, \gamma, \delta)}{f(\alpha, \beta, \gamma, \delta)} = f(x | p, q) f(p, q | \alpha, \beta, \gamma, \delta)
$$
Here the first step uses Bayes' Theorem and the second step uses the factorization of the network given the structure.
In fact, it seems your structure allows even more factorization, as $p$ is conditionally independent of $\gamma$ and $\delta$, given $\alpha$ and $\beta$, and something similar holds for $q$:
$$
f(p, q | \alpha, \beta, \gamma, \delta) = f(p | \alpha, \beta) f(q | \gamma, \delta)
$$
Hope this helps! For more information, see https://en.wikipedia.org/wiki/Bayesian_network.
A: This is straightforward from definitions, albeit a bit confusing. Note that if you condition, the rules of probability do not change. E.g. 
$$
P( A, B |C ) = P(A |B,C ) P(B|C), 
$$
just like
$$
P(A,B ) = P(A |B ) P(B).
$$
Now that we know that, your derivation is almost trivial.
For my convenience, I will let $v = (\alpha,\beta,\gamma, \delta )$. 
\begin{align}
f( x, p, q | v )  &= f(x | p,q,v ) f( p,q | v )\\
&= f(x |p,q) f(p,q |v),
\end{align}
since $x$ is independent of $v$ given $p,q$, by the graph (the graph is only a conveinient way to make such statements in a pictorial way).
You can even push this a bit further:
\begin{align}
f( x, p, q | v )  &= f(x | p,q,v ) f( p,q | v )\\
&= f(x |p,q) f(p,q |v) \\
&= f(x |p,q) f(p| v) f(q|v ) \text{ (1) }\\
&= f(x |p,q) f(p| \alpha, \beta) f(q|\gamma, \delta ) \text{ (2) }\\
\end{align}
(1) again, from the graph, $p,q$ are independen given $v$ (in fact, they are just independent.
(2) $p$ only dependes on $\alpha, \beta$ and not on $\gamma,\delta$. Similar arguments for $q$.
