# Integrated mixed model testing correlation and difference in correlation across factors

I'm currently performing the following analysis :

1. Computing $$r_j(Y_{ij}, X_{ij})$$ for each design cell (factor with level 1 or 0 for each unit)

2. Estimating effect of factor on $$r(Y,X)$$ with a linear model :
$$r_j(Y,X) \sim \mathcal{N}(\mu, \sigma)$$
where
$$\mu = \alpha + \mathbf{\beta} \mathbf{X}$$ with $$\mathbf{X} = \matrix{1, 0}$$
Additionally I include random effects but for the sake of simplicity I don't write it down.

My question is whether one can build an integrated model simultaneously computing the correlation (preserving its uncertainty) and test for the effect of the factor. I have guessed the following but I can't find any relevant literature to back up my thought :

$$\mathbf{Y} \sim \mathcal{MVN}(\mathbf{M}, \Sigma)$$ with $$\mathbf{Y} = \matrix{X, Y}$$
where
$$\mathbf{M} = \mathbf{A} + \mathbf{B} \mathbf{X}$$ with $$\mathbf{A}$$ and $$\mathbf{B}$$ being vectors of corresponding parameters for $$X$$ and $$Y$$
and $$\Sigma = \pmatrix{\sigma_X & \sigma_X \sigma_Y \rho \\ \sigma_X \sigma_Y \rho & \sigma_Y}$$ where (at least) $$\rho \sim \alpha + \mathbf{\beta} \mathbf{X}$$

I would like to make inferences for $$\mathbf{A}$$, $$\mathbf{B}$$ and $$\rho$$ in the same model. Naively the logic seems OK but I guess that I might miss some assumptions or other potential source of problems by building such a model.