rn_phi_decomp | R Documentation |
\varphi
-decomposition of V_{\text{Plas}}
This function calculates, for a linear (in its parameters) model, the plastic variance of the average (over genotypes) reaction norm shape V_{\text{Plas}}
and its \varphi
-decomposition (depending on the parameters rather than slope/curvature). This is especially useful when the reaction norm model was a polynomial.
rn_phi_decomp(theta, X, S = NULL, wt_env = NULL, correction = FALSE, v_plas = NA)
theta |
Average parameters of the shape function. It must be a named vector, with the names corresponding to the parameters in the |
X |
The design matrix X of the reaction norm model. For a polynomial, X contains all the exponents of the environment. (numerical matrix) |
S |
The error variance-covariance matrix of the estimated fixed effects |
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) |
v_plas |
If already computed, an estimate for |
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. Its \phi
-decomposition is based on the parameters of the linear model \mathbf{X}\theta
, rather than on slope and curvature, as for the \pi
-decomposition.
It is very important that the parameters are in the same order in theta
(which, again, must be named) and in G_theta
.
This function yields the \pi
-decomposition of V_{\text{Plas}}
as a one-row data.frame. If V_{\text{Plas}}
was provided as an argument (e.g. as computed from a separate character-state model), it also outputs M^2
, the ratio between V_{\text{Plas}}
as computed from the linear model parameters and the provided value for V_{\text{Plas}}
(data.frame, all numeric).
Pierre de Villemereuil
rn_pi_decomp
, rn_vplas
# Parameters
vec_env <- rnorm(20)
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)
# Computing the phi-decomposition
rn_phi_decomp(theta = theta, X = X, S = S)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.