rn_vtot | R Documentation |
V_{\text{Tot}}
This function calculates the total phenotypic variance V_{\text{Tot}}
arising along and beyond the reaction norm, i.e. including the residual variance.
rn_vtot(theta, V_theta, var_res, env = NULL, shape = NULL, X = NULL, S = NULL,
fixed = NULL, wt_env = NULL, correction = FALSE, width = 10)
theta |
Average parameters of the shape function. It must be a named vector, with the names corresponding to the parameters in the |
V_theta |
Full variance-covariance matrix of the parameters. It can be of lesser dimensions than |
var_res |
Residual variance beyond the reaction norm. It could be a scalar if this residual variance is assumed homogeneous or a vector the same length as |
env |
Vector of environmental values (numeric). |
shape |
Expression providing the shape of the reaction where |
X |
If the model used was linear in the parameters, the design matrix X of the model (numeric, incompatible with the arguments |
S |
The error variance-covariance matrix of the estimated fixed effects |
fixed |
If some parameters of |
wt_env |
Weights to apply to the |
correction |
Should Bessel's correction (dividing the sum-of-squares by N-1 rather than N) be used (TRUE) or not (FALSE, default). The default is FALSE, because it is likely that other components such as the total phenotypic variance is computed over the number of individuals (generally large number) rather than the number of environments (generally small number). The best is to manually use Bessel's correction over the proper number of data points. (boolean) |
width |
Parameter for the integral computation. The integral is evaluated from |
The variance V_{\text{Tot}}
is the total phenotypic variance of the trait along and beyond the reaction norm. In the simplest case, it is equal to the sum V_{\text{Plas}} + V_{\text{Gen}} + V_{\text{Res}}
, in which case this function is rather useless. But in cases where the parameters \theta
in the reaction norm curve is fitted with more than the (additive) genetic effect, then computing V_{\text{Tot}}
becomes non-trivial. This function allows to do it, e.g. by providing (i) a way to specify the full variation assumed in \theta
, using the V_theta
full variance-covariance argument, and (ii) a way to specify a varying residual variance by environment.
This function yields the total phenotypic variance along and beyond the reaction norm (numeric).
Pierre de Villemereuil
rn_vplas
, rn_vgen
# Some environment vector
vec_env <- seq(-2, 2)
# Shape function
expr <- expression(
cmax * exp(
- exp(rho * (x - xopt) - 6) -
sigmagaus * (x - xopt)^2
))
# Theta
theta <- c(cmax = 1, xopt = 0.9, rho = 8, sigmagaus = 0.4)
# G, only for cmax and xopt
G <- matrix(c(0.1, 0.01,
0.01, 0.05),
ncol = 2)
# Another covariance matrix for cmax and xopt (e.g. permanent environment, or maternal effet)
M <- matrix(c(0.05, 0,
0, 0.01),
ncol = 2)
# Full variance-covariance matrix
P <- G + M
# Residual variance
vr <- 0.1
# Computing V_tot
rn_vtot(theta = theta,
V_theta = P,
var_res = vr,
env = vec_env,
shape = expr,
fixed = c(3, 4))
# Note that fixed is set for the third and forth parameters than are not in P
# With varying residual variance along the environmental (here with environmental variance)
vr <- 0.05 * (vec_env^2)
rn_vtot(theta = theta,
V_theta = P,
var_res = vr,
env = vec_env,
shape = expr,
fixed = c(3, 4))
# Same result because the average of Vr is the same as the unique value above
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.