**Environmental interaction (E by E)**

Interaction between recorded environments can be fitted as fixed or random effects, please use colon as separator.

If fitted as fixed effects:

./hiblup ... --dcovar 2,2:3:6

Above command represents that the fixed effects of this trait are "*sex*", the interaction among "*sex*", "*season*", "*loc*".

If fitted as random effects:

./hiblup ... --rand 6,6:7,7

Similarly, the random effect for this trait are "*loc*", the interaction between "*loc*" and "*dam*", and "*dam*".

For multiple trait model, use space for separator, take 3 traits for an example:

./hiblup ... --dcovar 2:3 0 2,3,2:3 --rand 6 7,6:7 0

which means the fixed effect for the first trait is the interaction between "*sex*", "*season*", no fixed effect for the second trait, the fixed effects of the third trait are "*sex*", "*season*", and the interaction between "*sex*", "*season*"; the environmental random effects for the first trait is "*loc*", the second trait are "*dam*"and the interaction between "*loc*" and "*dam*", the third trait has no environmental random effect.

**Genetic interaction (G by G)**

HIBLUP can fit interaction for genetic random effect, for example: additive by additive, additive (A) by dominant (D), dominant by dominant, and so on, the number of genetic random effect at an interaction term is not limited. The interaction of G by G for *n* genetic random effects in HIBLUP can be mathematically formulated as following:

\begin{equation} \begin{aligned} G_{inter} &= \frac{G_1 \bigodot G_2 \bigodot ... \bigodot G_n}{tr(G_1 \bigodot G_2 \bigodot ... \bigodot G_n) / N} \end{aligned} \end{equation}

where N is the number of individuals, \bigodot is the Hadamard product (i.e. element-wise multiplica-tion) of all matrix, and tr() is the trace of the matrix.

The only way to fit G by G is to appoint the prefix of the random effects to flag `--xrm`

, please use colon as separator within an interaction term:

# fit A by D only ./hiblup ... --xrm demo.GA:demo.GD #fit A, D, and A by D ./hiblup ... --xrm demo.GA,demo.GD,demo.GA:demo.GD #fit A by A, A by D and D by D simultaneously ./hiblup ... --xrm demo.GA:demo.GA,demo.GA:demo.GD,demo.GD:demo.GD

**Genetic-Environmental interaction (G by E)**

Genetic-Environmental interaction will be included in the model as random effect, please assign a digital value representing its position at phenotype file for environment factors, and assign prefix of the genetic effects to the flag "`--rand-gxe`

".

For single trait model, please use colon as separator within an interaction term, and use comma as separator for multiple interaction terms, for example:

./hiblup --single-trait ... --rand-gxe 6:demo.GA,6:demo.GD #interaction among multiple effects ./hiblup --single-trait ... --rand-gxe 6:demo.GA:demo.GD ./hiblup --single-trait ... --rand-gxe 6:7:demo.GA

For multiple traits model, please use space among traits, use 0 if there is no G by E interaction to be considered for a trait, take 3 traits for an example:

./hiblup --multi-traits ... --rand-gxe 6:demo.GA 6:demo.GA,7:demo.GA 0

Above command means that the interaction for the first trait is "*loc*" by additive genetic effect; the interactions for the second trait are "*loc*" by additive genetic effect and "*dam*" by additive genetic effect; no interactions are considered for the third trait.