  Structural equation modeling (SEM) is a popular tool in the social and
behavioural sciences, where it is being applied to ever more complex data
types. The high-dimensional data produced by modern sensors, brain images, or
(epi)genetic measurements require variable selection using parameter
penalization; experimental models combining disparate data sources benefit from
regularization to obtain a stable result; and genomic SEM or network models
lead to alternative objective functions. With each proposed extension,
researchers currently have to completely reformulate SEM and its optimization
algorithm -- a challenging and time-consuming task.
  In this paper, we consider each SEM as a computation graph, a flexible method
of specifying objective functions borrowed from the field of deep learning.
When combined with state-of-the-art optimizers, our computation graph approach
can extend SEM without the need for bespoke software development. We show that
both existing and novel SEM improvements follow naturally from our approach. To
demonstrate, we discuss least absolute deviation estimation and penalized
regression models. We also introduce spike-and-slab SEM, which may perform
better when shrinkage of large factor loadings is not desired. By applying
computation graphs to SEM, we hope to greatly accelerate the process of
developing SEM techniques, paving the way for new applications. We provide an
accompanying R package tensorsem.
