All model-terms in bayz are speficied using a small function to specify
how to treat and fit a variable.
The currently available model-terms are:

- rg() to fit a regression on a covariate.

- fx() to fit fixed effects on factors.

- rn() to fit random effects on factors.

- rr() to fit random regressions and Bayesian shrinkage on a table/matrix of covariates.

The rg() and fx() model terms are most straightforward as they don't take special options. Interactions can be specified in fx() using the colon (:) to any degree, but there is no feature to automatically include main effects and lower-level interactions as with the R * syntax. In bayz, main effects and lower-level interactions need to be added explicitly in the model.

Random effects can be specified with default IID (no correlation) structure, or with correlated structures based on one or a multiplication of several similarity / kernel matrices.

To fit the default uncorrelated random effects, equivalent to a standard lmer() model fit, simply flip fx() for rn(). A variance parameter will be estimated using an unbounded uniform prior, but priors can be modified if desired (see below). Interactions are handled the same as in fx().

Random effects with a correlation structure based on a similarity / relationship / kernel matrix are fitted by adding a V= term inside the rn() specification, such as:

bayz(Yield ~ rn(Variety, V=Grel), ...)where Grel could be a Genomic relationship matrix to fit the GBLUP model.

When fitting an interaction in rn() and using the V= term to set a correlation-structure, one matrix for each interacting term should be given separated by *, and the variance-structure is interpreted as being the Kronecker product of the given matrices. This looks like:

bayz(Yield ~ rn(Variety:Location, V=Grel*LSim), ...)where now Lsim could be a matrix (for instance based on weather data) specifying similarities between Locations.

Another well-known model in plant breeding making use of such multiplication of matrices is to fit Special Combining Abilities (or hybrid effects) between parents. When using both main effects for parents and their interaction, this is specified in bayz as:

bayz(Yield ~ rn(Par1, V=Gpar) + rn(Par2, V=Gpar) + rn(Par1:Par2, V=Gpar*Gpar), ...)Assuming the Par1 and Par2 lists of parents actually contain the same parents, the SCA effects between parents is based on using only one Gpar matrix. The quantitative genetic background for the above example is that it will fit the additive x additive epistasis between parents if Gpar is a standard additive Genomic relationship matrix (you could set-up other matrices to capture dominance effects).

See the section on Extra Data how to set-up the similarity / kernel matrices so that bayz can match names of IDs with your main data.