rn_vplas | R Documentation |
V_{\text{Plas}}
This function calculates the purely environmental plastic variance arising from the average (across genotypes) shape of the reaction norm.
rn_vplas(theta, V_theta, 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 |
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{Plas}}
is the variance arising from the shape of the reaction norm after avering over the genetic variance, i.e. the purely environmental part of the variance of plasticity in the reaction norm.
It is very important that the parameters are in the same order in theta
(which, again, must be named) and in V_theta
.
This function yields V_{\text{Plas}}
(numeric).
Pierre de Villemereuil
rn_mean_by_env
, rn_pi_decomp
, rn_vgen
, rn_vtot
# 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)
# Computing V_plas
rn_vplas(theta = theta,
V_theta = G,
env = vec_env,
shape = expr,
fixed = c(3, 4))
# Note that fixed is set for the third and forth parameters than are not in G
# Note the quite large difference when Bessel's correction is used
rn_vplas(theta = theta,
V_theta = G,
env = vec_env,
shape = expr,
fixed = c(3, 4),
correction = TRUE)
# It is possible to weight the environment, e.g. according to a normal distribution
rn_vplas(theta = theta,
V_theta = G,
env = vec_env,
shape = expr,
fixed = c(3, 4),
wt_env = dnorm(vec_env),
correction = TRUE)
# If a polynomial was used, it is possible to use the linear modeling rather having
# to compute integrals
theta <- c(a = 1.5, b = 0.5, c = -0.5)
X <- cbind(1, vec_env, (vec_env - mean(vec_env))^2)
S <- (10^-4) * diag(3)
rn_vplas(theta = theta, X = X, S = S)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.