# Nested likelihoods?

Hi all, I have a model that has a “triangular setup” as below:

y_{1,t} = \Pi_1 X_t + \lambda_1^{0.5}\epsilon_{1,t}
y_{2,t} = \Pi_2 X_t + \alpha \lambda_1^{0.5}\epsilon_{1,t} + \lambda_2^{0.5}\epsilon_{2,t}

With priors on \Pi_i, \alpha, and \lambda_i. The error terms are IID normal.

I know this would be pretty straightforward to implement in pymc3 if I arranged them in multivariate normal format, however the actual model I’m working with is large and I was hoping to utilize the fact that I should be able to estimate the model equation-by-equation.

For example, y_{1,t}\sim \mathcal{N}(\Pi_1X_t, \lambda_1) and y_{2,t} -\alpha \lambda_1 \epsilon_{1,t} \sim \mathcal{N}(\Pi_2 X_t , \lambda_2 )

Relatively new to this but hoping someone might help me set up the model in this ^ format. Is there a way to incorporate the residuals in the likelihood of y_{1,t} into the likelihood for y_{2,t}?

Hi @brianleblanc, would that be a correct representation of your model:

\Pi_i\sim \text{Some Prior}\\ \alpha \sim \text{Some Prior}\\ \lambda_i \sim \text{Some Prior}\\ y_{1,t} \sim N(\Pi_1 X_t, \lambda_1) \\ y'_{2,t} \sim N(\Pi_2 X_t , \lambda_2) \\ y_{2,t} = y'_{2,t} - \alpha(y_{1,t} - \Pi_1 X_t)