rn_pi_decomp | R Documentation |
\pi
-decomposition of V_{\text{Plas}}
This function calculates the plastic variance of the average (over genotypes) reaction norm shape V_{\text{Plas}}
and its \pi
-decomposition into \pi_{\text{Sl}}
and \pi_{\text{Cv}}
.
rn_pi_decomp(theta, V_theta, env, shape, 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 |
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 averaging over the genetic variance, i.e. the purely environmental part of the variance of plasticity in the reaction norm. Its \pi
-decomposition into a slope (\pi_{\text{Sl}}
) and curvature (\pi_{\text{Cv}}
) components allows to distinguish the importance of each of those components in V_{\text{Plas}}
. Note that the \pi
-decomposition requires that the environmental variable is normally distributed, or that the reaction norm shape is quadratic.
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 the \pi
-decomposition of V_{\text{Plas}}
as a one-row data.frame (data.frame, all numeric).
Pierre de Villemereuil
rn_mean_by_env
, rn_vplas
# Some environment vector
vec_env <- rnorm(20)
# 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 the pi-decomposition of V_Plas
rn_pi_decomp(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
# Applying some weighting to the environmental values according to a normal distribution
# if the env variable is actually fixed
vec_env2 <- seq(-2, 2, length.out = 20)
rn_pi_decomp(theta = theta,
V_theta = G,
env = vec_env2,
shape = expr,
fixed = c(3, 4),
wt_env = dnorm(vec_env2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.