ocsFun {evola}R Documentation

Fitness function from contribution theory

Description

Simple function for fitness where an index of traits is weighted by the group relationship.

Usage

ocsFun(Y,b,Q,D,a,lambda,scaled=TRUE)

Arguments

Y

A matrix of trait values. See details.

b

A vector of trait weights. See details.

Q

A QTL matrix. See details.

D

An LD matrix. See details.

a

A named list with vectors of average allelic effects per trait. See details.

lambda

A numeric value to weight the Q'DQ portion of the objective function (to be provided by the user with the lambda argument). See details.

scaled

A logical value to indicate if traits should be scaled prior to multiply by the weights.

Details

A simple apply function of a regular index weighted by a vector of relationships.

Y%*%b - d

Internally, we use this function in the following way:

The Y matrix is the matrix of trait-GEBVs and b is the user-specified trait weights.

d = qtDq * lambda; where qtDq is equal to Matrix::diag(Q%*%Matrix::tcrossprod(D,Q)) of dimensions n x n

Notice that Q represents the marker of QTLs (columns) for all solutions (rows) and D the LD between QTLs. The user can modify this function as needed and provide it to the evolafit function along with other arguments.

Notice that a is a list with elements named as the traits specified in your formula.

Value

$res

a vector of values

References

Giovanny Covarrubias-Pazaran (2024). evola: a simple evolutionary algorithm for complex problems. To be submitted to Bioinformatics.

See Also

evolafit – the core function of the package

Examples



Y=matrix(1:12,4,3) # 4 solutions with 3 traits

Q=matrix(sample(0:1,32,replace = TRUE),nrow=4,ncol=8) # coancestry for each solution

D=diag(8)

b=rep(1,3)

lambda=0.5

ocsFun(Y=Y,Q=Q,D=D,b=b, lambda=lambda) # Yb - d where d is QAQ' and A is the LD between QTNs



[Package evola version 1.0.5 Index]