# Solve mixed model

The objective of solving mixed model is to obtain the estimated breeding values of all individuals by using the known genetic parameters. HIBLUP automatically switches to single trait or multiple traits model by the length of specified flag --pheno-pos. Always remember that there is no need to adjust the order of individuals or markers to be consistent among different files, HIBLUP can do it automatically.
Taking GBLUP model for an example, the command for single trait and multiple traits model is as following:

# (1) additive effect for single trait model
./hiblup --mme
--pheno demo.phe
--pheno-pos 8
--rand 6
--xrm demo.GA   # can be replaced by --bfile demo --add
--vc-priors v1,v2,v3
--pcg
--out demo

# (2) additive and dominant effect for multiple traits model
./hiblup --mme
--pheno demo.phe
--pheno-pos 8 9 10
--rand 6,7 7 0
--bfile demo   # can be replaced by --xrm demo.GA,demo.GD
--vc-priors t1_v1,t1_v2,t1_v3,t1_v4,t1_v5 t2_v1,
t2_v2,t2_v3,t2_v4 t3_v1,t1_v2,t1_v3
--covc-priors cov1,cov2,cov3 cov4,cov5,cov6 cov7,cov8,cov9
--pcg
--out demo

By default, HIBLUP directly compute the inverse of V matrix, users can try to add flag --pcg to use Preconditioned Conjugate Gradients algorithm to solve the system of linear equation, which is much more faster in certain situation.

IMPORTANT

(1) --vc-priors contains the variance components of all random effects, including environmental random effects, genetic random effects, and residuals, the provided variance components should also be in this order.
For single trait model, please use comma as separator, as shown in the first example command:

v1: the variance of the environmental random effect located
at the 6th column in phenotype file.
v3: the residual variance.

For multiple traits model, the variance components are listed trait by trait orderly, and please use comma within a trait, use space among traits, as shown in the second example command:

t1_v1: the variance of the environmental random effect located
at the 6th column in phenotype file for the first trait.
t1_v2: the variance of the environmental random effect located
at the 7th column in phenotype file for the first trait.
t1_v3: the variance of additive genetic effect for the first trait.
t1_v4: the variance of dominant genetic effect for the first trait.
t1_v5: the variance of residuals for the first trait.
t2_v1: the variance of the environmental random effect located
at the 7th column in phenotype file for the second trait.
t2_v2: the variance of additive genetic effect for the second trait.
t2_v3: the variance of dominant genetic effect for the second trait.
t2_v4: the variance of residuals for the second trait.
t3_v1: the variance of additive genetic effect for the third trait.
t3_v2: the variance of dominant genetic effect for the third trait.
t3_v3: the variance of residuals for the third trait.

(2) --covc-priors contains the co-variance components among traits at all genetic random effects, the co-variance components are listed by genetic random effect orderly, and please use comma within a genetic random effect, use space among genetic random effects, the input order can be referred as following:

where each box represents a genetic random effect, the off-diagonals are the co-variances between traits at this genetic random effect, and the diagonals are its variance at different traits. The number of box is equal to the number of XRM plus 1, where “1” is the residual. Users need to assign values at the lower triangle of each box to HIBLUP:

cov1: the co-variance between the first and second trait at "demo.GA".
cov2: the co-variance between the first and third trait at "demo.GA".
cov3: the co-variance between the second and third trait at "demo.GA".
...

The order of input co-variances should strictly follow the route in the above figure.