cov_trait | R Documentation |
This function returns the expected covariance matrix of trait vectors simulated via sim_trait()
and sim_trait_mvn()
.
Below there are n
individuals.
cov_trait(kinship, herit, sigma_sq = 1, labs = NULL, labs_sigma_sq = NULL)
kinship |
The |
herit |
The desired heritability (proportion of trait variance due to genetics). |
sigma_sq |
The desired parametric variance factor of the trait (scalar, default 1). Corresponds to the variance of an outbred individual. |
labs |
Optional labels assigning individuals to groups, to simulate environment group effects.
Values can be numeric or strings, simply assigning the same values to individuals in the same group.
If vector (single environment), length must be number of individuals.
If matrix (multiple environments), individuals must be along rows, and environments along columns.
The environments are not required to be nested.
If this is non- |
labs_sigma_sq |
Optional vector of environment effect variance proportions, one value for each environment given in |
The n
-by-n
trait covariance matrix, which under no environment effects equals
sigma_sq * ( herit * 2 * kinship + sigma_sq_residual * I )
,
where I
is the n
-by-n
identity matrix and sigma_sq_residual = 1 - herit
.
If there are labels, covariance will include the specified block diagonal effects and sigma_sq_residual = 1 - herit - sum(labs_sigma_sq)
.
sim_trait()
, sim_trait_mvn()
# create a dummy kinship matrix
kinship <- matrix(
data = c(
0.6, 0.1, 0.0,
0.1, 0.6, 0.1,
0.0, 0.1, 0.6
),
nrow = 3,
byrow = TRUE
)
# covariance of simulated traits
V <- cov_trait(kinship = kinship, herit = 0.8)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.