# covariance of a structural equation model

I'm trying to create a Bayesian structural equation model where I can specify directional paths between observations, latent variables, and indicators.

I use the term observations to refer to data with potential associated errors. For example, suppose I'm trying to model the classic data from Holzinger and Swineford (1939) where children from two different schools completed the same set of tests. Here, observations would be test scores.

Latent variables are unobserved variables that potentially influence the observations and one another For example, one might be general intelligence.

Finally, indicators are observations that have no error. For example, one indicator might be the school.

So far, I have figured out how to create paths from latent variables to items, and from one latent variable to another. I assume that observations are multivariate normal,

$$\boldsymbol{Y}\sim\mathrm{Normal}\left(\boldsymbol{\mu},\boldsymbol{\Sigma}\right)$$

where $$\boldsymbol{\mu}$$ is a $$p$$-length vector of means and $$\boldsymbol{\Sigma}$$ is an $$n \times p$$ covariance matrix. For former is given by

$$\boldsymbol{\mu}=\boldsymbol{\nu}+\boldsymbol{\Lambda}\boldsymbol{\alpha}$$

where $$\boldsymbol{\nu}$$ is $$p$$-length vector of observation intercepts, $$\boldsymbol{\Lambda}$$ is a sparse $$p \times m$$ matrix of paths from latent variables to observations, and $$\boldsymbol{\alpha}$$ is a $$m$$-length vector of latent intercepts.

The covariance matrix $$\boldsymbol{\Sigma}$$ is given by

$$\boldsymbol{\Sigma}=\boldsymbol{\Lambda}(\boldsymbol{I}-\boldsymbol{B})^{-1}\boldsymbol{\Psi}(\boldsymbol{I}-\boldsymbol{B}^\mathrm{T})^{-1}\boldsymbol{\Lambda}^\mathrm{T}+\boldsymbol{\Theta}$$

where $$\boldsymbol{B}$$ is a sparse matrix of paths from latent variables to latent variables, $$\boldsymbol{\Psi}$$ is an $$m \times m$$ diagonal matrix of latent variances, and $$\boldsymbol{\Theta}$$ is a $$p \times p$$ diagonal residual variance matrix.

I want to modify this model so that I can specify paths between indicators (let's say they are stored in matrix $$\boldsymbol{X}$$) and latent variables. Let's call this matrix $$\boldsymbol{A}$$.

I think I must modify $$\boldsymbol{\Theta}$$ to something like $$\boldsymbol{A}\boldsymbol{\Theta}\boldsymbol{A}^\mathrm{T}$$ but not sure where $$\boldsymbol{X}$$ should go.

Instead, you can hack your way around it. For the indicator of interest, create it's own latent variable, for that element, the value of $$\Lambda$$ is 1.00, and the error variance is 0.00. Now the latent variable and the measured variable are interchangeable, and you can add the appropriate path to $$B$$.