What is the correct likelihood function for an sequential, adaptive data generation process? Consider the following sequential, adaptive data generating process for $Y_1$, $Y_2$, $Y_3$. (By sequential I mean that we generate $Y_1$, $Y_2$, $Y_3$ in sequence and by adaptive I mean that $Y_3$ is generated depending on the observed values of $Y_1$ and $Y_2$.):
$Y_1 = X_1\  \beta + \epsilon_1$
$Y_2 = X_2\  \beta + \epsilon_2$
$Y_3 = X_3\  \beta + \epsilon_3$
$
X_3 = 
\begin{cases} 
 X_{31} & \mbox{if }Y_1 Y_2  \gt  0 \\ X_{32} & \mbox{if }Y_1 Y_2 \le 0
\end{cases}$
where,
$X_1$, $X_2$, $X_{31}$ and $X_{32}$ are all 1 x 2 vectors.
$\beta$ is a 2 x 1 vector
$\epsilon_i \sim N(0,\sigma^2)$ for $i$ = 1, 2, 3
Suppose we observe the following sequence: {$Y_1 = y_1,\ Y_2 = y_2,\ X_3 = X_{31},\ Y_3 = y_3$} and wish to estimate the parameters $\beta$ and $\sigma$. 
In order to write down the likelihood function note that we have four random variables: $Y_1$, $Y_2$, $X_3$ and $Y_3$. Therefore, the joint density of $Y_1$, $Y_2$, $X_3$ and $Y_3$ is given by:
$f(Y_1, Y_2, X_3, Y_3 |-) = f(Y_1|-)\ f(Y_2|-)\ [\ f(Y_3|X_{31},-)\ P(X_3=X_{31}|-)$
$\qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad \qquad + \ f(Y_3|X_{32},-)\ P(X_3={X_{32}}|-)\ ]$ 
(Note: I am suppressing the dependency of the density on $\beta$ and $\sigma$.)
Since the likelihood conditions on the observed data and our sequence is such that $y_1 y_2 >0$. Therefore, we have:
$L(\beta,\ \sigma | X_1,\ X_2,\ X_{31}, y_1, y_2, y_3) = f(Y_1|-)\ f(Y_2|-)\ f(Y_3|X_{31},-)\ P(X_3=X_{31}) $
Is the above the correct likelihood function for this data generating process?
 A: It depends on exactly what you mean - your notation is a bit ambiguous. If I understand your notation correctly, you don't actually have 4 independent random variables - $X_3$ is a deterministic function of $Y_1$ and $Y_2$, and so it shouldn't occur explicitly in the likelihood. $Y_3$ is a function of the deterministic node $X_3$, and hence is a function of $Y_1$ and $Y_2$ when you drop out the deterministic node to form the likelihood, which is:
$f(Y_1)f(Y_2)f(Y_3|Y_1,Y_2)$
provided that $Y_1Y_2>0$ (for consistency with data on $X_3$) and is zero otherwise. Is that what you meant?
A: This is all correct, except you don't need the last term: $P(X_3=X_{31})$.  You observe the data $Y_1$ and $Y_2$, so you know whether $X_3=X_{31}$ or $X_3=X_{32}$.  
Another way to see this is that the likelihood function for this system is is:
$L(\theta) = P(Y_1,Y_2,Y_3|\theta) = P(Y_1|\theta)P(Y_2|\theta)P(Y_3|Y_1,Y_2,\theta)$.
The right most term is:
$P(Y_3|Y1,Y2,\theta) = 
\begin{cases} 
 f(Y_3|X_{31},-) & \mbox{if }Y_1 Y_2  \gt  0 \\ f(Y_3|X_{32},-) & \mbox{if }Y_1 Y_2 \le 0
\end{cases}$
You could write that out using an indicator function of $Y_1Y_2$ if you wanted to, 
$f(Y_3|X_{31},-)\cdot \mathbb{I}(Y_1Y_2>0) + f(Y_3|X_{32},-)\cdot \mathbb{I}(Y_1Y_2\leq 0)$, where $\mathbb{I}(\cdot)$ is 1 if its argument is true and 0 otherwise. 
