## Fitting a factor-analytic model

- fa_example.par
COM Example par file for FA model ANAL MUV PC 6 PEDS ../carcped.dat DATA ../carcsix.dat GRP TRNOS 1 2 3 4 5 6 traitno 6 animal 0 bnimal 0 cg 299 NAMES cwt cema cimf crby cp8 crib END MODEL FIX cg RAN animal nrm RAN bnimal nrm tr cwt 1 tr cema 2 tr cimf 3 tr crby 4 tr cp8 5 tr crib 6 END MOD VAR animal 6 1 177 29 3.1 -11 15 8 9.8 0.03 -0.2 1.2 1.6 0.91 -0.76 0.9 0.3 3.62 -2.9 -1.96 4.95 2.2 1.95 VAR bnimal 6 6 DIAG 50 3 0.3 0.5 1.1 0.8 VAR residual 6 6 292 39 3.2 -5.9 22.4 11. 36 0.8 -0.9 4.7 1.2 1 -0.06 0.15 0.32 0.73 -0.55 -0.45 6.9 2.0 5.1

WOMBAT can accommodate a factor-analytic model for the structure of covariance matrices of random effects. While there is no explicit option for this structure, it is easily fitted indirectly.

Factor analysis implies a latent model which models a random effect (${\bf r}$) for a set of traits as the sum of a vector of $m$ common effects (${\bf c}$), weighted by a matrix of factor loadings (${\bf F}$), and a vector of $q$ specific effects (${\bf s}$). i.e.
$${\bf r} = {\bf F} {\bf c} + {\bf s} $$
The common effects are assumed to be *iid* distributed with
variances of unity, while the specific effects are assumed to be uncorrelated but have heterogeneous variances. This gives
$$Var({\bf r}) = {\bf F} {\bf F}' + {\bf D}$$
with ${\bf D}$ the the diagonal matrix of specific variances.

WOMBAT allows for the first part, i.e. has an option which allows $Var({\bf r})$ to be estimated as ${ \bf F F}'$ with reduced rank $m$. In addition, WOMBAT incorporates an option for diagonal covariance matrices.

Hence a factor-analytic model is readily fitted by simply fitting the corresponding random effect *twice*:

- In the first instance with reduced rank covariance matrix, representing the
**common**factors

(`animal`

in the example), and - in the second instance with diagonal covariance matrix, representing the
**specific**effects

(`bnimal`

in the example).

WOMBAT only allows a particular column in the data file to be used once, i.e. to be mapped to a single effect in the model of analysis. Hence, fitting a factor-analytic structure for a particular effect requires the corresponding code (column) in the data file to be replicated!

If WOMBAT encounters two random effects, listed successively in the .par file, with the names only differing by the first letter (e.g. `animal`

and `bnimal`

in Example 5) and with reduced rank and diagonal covariance matrices, respectively, it will assume that a factor-analytic model has been intended and automatically write out summary statistics for the sum of the two matrices.