calcGrpWprime {Morphoscape} | R Documentation |
Compute optimally weighted adaptive landscapes
Description
calcGrpWprime()
computes the optimally weighted adaptive landscape by searching through the adaptive landscapes formed from sets of weights and performance surfaces, and finding the set of weights that yields the greatest overall (average) fitness value (Z) across a sample of data or a subset thereof.
Usage
calcGrpWprime(x, index, method = "chi-squared",
quantile = 0.05)
## S3 method for class 'grp_Wprime'
print(x,
digits = max(3L, getOption("digits") - 3L), ...)
Arguments
x |
for for |
index |
an optional vector of indices indicating which subset of the |
method |
the method used to compute the optimal weights. Allowable options include |
quantile |
when |
digits |
the number of significant digits to print. |
... |
passed to |
Details
calcGrpWprime()
calculates an overall fitness score for each set of weights based on the average weighted fitness values of the indexed subgroup. The set of weights that optimizes this score is then produced as the weights defining the optimal adaptive landscape for that subgroup. The way the final set of weights is computed depends on the argument to method
. When method = "max"
, the single best set of weights is used. However, often many of the upper sets of weights perform equally or nearly equally as well as the best set. It is instead recommended to use "quantile"
or "chi-squared"
methods. When method = "quantile"
, the top X\%
of weights are averaged to compute the optimal weights, where X
corresponds to the value supplied to quantile
. When method = "chi-square"
, the chi-squared value \chi^2_i
is computed for each set of weights i
as
\chi^2_i = -2 \log \frac{Z_{max}}{Z_i}
where Z_{max}
is the largest Z
among the weights, and a p-value is computed for each \chi^2_i
value using a \chi^2
distribution with 2 d.f.; any set of weights with a p-value less than quantile
is included to be averaged to compute the optimal set of weights.
Value
A grp_Wprime
object, which contains the following components:
Zprime |
a list containing the optimal weights and the Z value they yield ( |
W |
a matrix containing all sets of weights (i.e., those supplied to the |
Wprime |
a |
References
Dickson, B. V., Clack, J. A., Smithson, T. R., & Pierce, S. E. (2021). Functional adaptive landscapes predict terrestrial capacity at the origin of limbs. Nature, 589(7841), 242-245.
Jones, K. E., Dickson, B. V., Angielczyk, K. D., & Pierce, S. E. (2021). Adaptive landscapes challenge the "lateral-to-sagittal"" paradigm for mammalian vertebral evolution. Current Biology, 31(9), 1883-1892.
See Also
calc_all_lscps
for computing the landscapes which are to be optimized.
calcWprimeBy
for finding optimal sets of weights for multiple subgroups defined by a subgrouping variable.
plot.grp_Wprime
for plotting the resulting adaptive landscape.
Examples
data("warps")
data("turtles")
warps_fnc <- as_fnc_df(warps,
func.names = c("hydro", "fea"))
kr_surf <- krige_surf(warps_fnc, new_data = turtles)
grid_weights <- generate_weights(n = 3, data = kr_surf)
all_lscps <- calc_all_lscps(kr_surf,
grid_weights = grid_weights)
wprime_S <- calcGrpWprime(all_lscps,
index = Ecology == "S")
wprime_S
plot(wprime_S)