rn_mean_by_env | R Documentation |
This function calculates the phenotypic mean on the observed scale from the latent mean and variance.
rn_mean_by_env(theta, V_theta, env, shape, fixed = NULL, 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 |
width |
Parameter for the integral computation. The integral is evaluated from |
This function yields the phenotypic average (across genotypes) for each value of the environment. If the reaction norm is not linear in its parameters (the parameters in theta
), then this average will generaly differ from the value yielded by shape
evaluated at values in theta
.
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 phenotypic mean for each value of the environmental vector provided (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)
# Computing mean by environment
rn_mean_by_env(env = vec_env,
shape = expr,
theta = theta,
V_theta = G,
fixed = c(3, 4))
# Note that fixed is set for the third and forth parameters than are not in G
# This is (slightly) different from the function evaluated
# using the average values of the parameters in theta
theta["cmax"] * exp(
- exp(theta["rho"] * (vec_env - theta["xopt"]) - 6) -
theta["sigmagaus"] * (vec_env - theta["xopt"])^2
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.