default_initial_variance | R Documentation |
A function of the response vector or matrix (multi-trait case) returning a SPD matrix of conforming dimensions.
default_initial_variance(
x,
dim = 1,
cor.trait = NULL,
cor.effect = 0.1,
digits = NULL
)
x |
numeric vector or matrix with the phenotypic observations. Each trait in one column. |
dim |
integer. dimension of the random effect for each trait. Default is 1. |
cor.trait |
a number strictly in (-1, 1). The initial value for the correlation across traits. Default is NULL, which makes the function to take the value from the data. See Details. |
cor.effect |
a number strictly in (0, 1). The initial value for the correlation across the different dimensions of the random effect. Default is 0.1. |
digits |
numeric. If not NULL (as default), the resulting matrix is rounded up to 2 significant digits. |
The default initial covariance matrix across traits is computed as half the
empirical covariance kronecker times a Positive-Definite matrix with Compound
Symmetry Structure with a constant diagonal with value 1 and constant
off-diagonal elements with the positive value given by cor.effect
,
i.e.
\Sigma = Var(x)/2 \%*\% \psi(dim).
This implies that the default
initial correlations across traits equal the empirical correlations,
except if cor.trait
is not NULL
.
\psi(dim)
is intended to model correlated random effects within
traits, and only has an effect when dim
> 1.
If any column in x
is constant (i.e. empirical variance of 0) then the
function stops. It is better to remove this trait from the analysis.
## Initial covariance matrix for a bidimensional random effect
## acting independently over three traits
x <- cbind(rnorm(100, sd = 1), rnorm(100, sd = 2), rnorm(100, sd = 3))
breedR:::default_initial_variance(x, dim = 2, cor.effect = 0.5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.