calcWprimeBy {Morphoscape} | R Documentation |
Compute optimally weighted adaptive landscapes by subgroup
Description
calcWprimeBy()
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 subsets of a sample dataset.
Usage
calcWprimeBy(x, by, method = "chi-squared", quantile = 0.05)
## S3 method for class 'by_Wprime'
print(x,
digits = max(3L, getOption("digits") - 3L), ...)
## S3 method for class 'by_Wprime'
summary(object, ...)
## S3 method for class 'summary.by_Wprime'
print(x,
digits = max(3L, getOption("digits") - 3L), ...)
Arguments
x |
for for for |
by |
a one-sided formula containing the grouping variable on the right hand side (e.g., |
method |
the method used to compute the optimal weights. Allowable options include |
quantile |
when |
digits |
the number of significant digits to print. |
... |
passed to |
object |
a |
Details
calcWprimeBy()
splits the sample data based on the by
variable and then calls calcGrpWprime
on each subset. The main benefit of using calcWprimeBy()
is that the subgrouping variable is part of the output object and therefore can be used in plotting using plot.by_Wprime
.
Value
A by_Wprime
object contaning the following components:
by |
the subgrouping variable supplied to |
grp_Wprimes |
a list of |
See Also
calc_all_lscps
for computing the landscapes which are to be optimized.
calcGrpWprime
for finding optimal sets of weights for a single subgroup.
plot.by_Wprime
for plotting the resulting adaptive landscapes.
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_Ecology <- calcWprimeBy(all_lscps, by = ~Ecology)
wprime_Ecology
summary(wprime_Ecology)
plot(wprime_Ecology)