| calc_lscp {Morphoscape} | R Documentation |
Calculate a single weighted adaptive landscape
Description
calc_lscp() calculates a single weighted landscape from a set of kriged surfaces of functional characteristics and a set of weights for those characteristics. This landscape can then be plotted using plot.wtd_lscp. Additionally computes the fitness values for a sample of additional coordinates.
Usage
calc_lscp(data, weights, ...)
## S3 method for class 'kriged_surfaces'
calc_lscp(data, weights, ...)
## S3 method for class 'all_lscps'
calc_lscp(data, weights, i, ...)
Arguments
data |
a |
weights |
a vector of weights, one for each functional characteristic. These weights should be nonnegative and sum to 1. |
i |
when |
... |
ignored. |
Details
calc_lscp() operates on the kriged surfaces stored in data by multiplying the functional characteristic values of each point on the surface grid by the weights and computing the sum of those values to arrive at a "fitness" value that is represented by the maximum height of the combined adaptive landscape. When a new_data component is present in data (e.g., because a new_data argument was supplied to krige_surf() or data is the output of a call to krige_new_data()), the weighted fitness values will be computed for the coordinates in new_data as well.
Value
A wtd_lscp object, which contains the following components:
W |
a named vector of the supplied weights |
Wprime |
a list containing the weighted |
See Also
plot.wtd_lscp for plotting the resulting weighted landscape.
generate_weights for generating a matrix of weights.
calc_all_lscps for computing weighted landscapes for a matrix of weights (i.e., rather than the single set of weights that can be used with calc_lscp). For finding an optimal set of weights, calc_all_lscps should be used, though it only produces the weighted fitness values for each set of weightd and not the weighted functional characteristic surfaces.
Examples
data("warps")
warps_fnc <- as_fnc_df(warps, func.names = c("hydro", "fea"))
kr_surf <- krige_surf(warps_fnc)
weights <- c(hydro = .5, fea = .5)
w_lscp <- calc_lscp(kr_surf, weights = weights)
plot(w_lscp)
# Adding new_data
data("turtles")
kr_surf <- krige_new_data(kr_surf, new_data = turtles)
w_lscp <- calc_lscp(kr_surf, weights = weights)
w_lscp
plot(w_lscp)
## See further use with calc_all_lscps()
## at help("calc_all_lscps")