MF2_multiple {MF.beta4} | R Documentation |
multifunctionality measures for multiple ecosystems
Description
MF2_multiple
computes alpha, beta and gamma multifuctionality measures of orders q = 0, 1 and 2 for given function weights in multiple ecosystems separately for two cases
(i) correlations between functions are not corrected for, and (ii) correlations between functions are corrected for.
Usage
MF2_multiple(
func_data,
species_data = NULL,
weight = 1,
q = c(0, 1, 2),
by_group = NULL
)
Arguments
func_data |
ecosystem function data should be input as a data.frame (ecosystems by functions for multiple ecosystems). All function values must be normalized between 0 and 1. |
species_data |
species abundance data should be input as a data.frame and must include three columns: "plotID", "species" and "abundance". Default is |
weight |
a constant number (if all weights are equal) or a numerical vector specifying weights for ecosystem functions.
In the latter case, the length of |
q |
a numerical vector specifying the multifunctionality and diversity orders. Default is q = 0, 1 and 2. |
by_group |
the column name of the stratifying variable that is used to group data for performing decomposition.
For example, if |
Value
a data.frame with columns "plotID" (combinations of plot pairs), "Order.q" , "Type" (corr_uncorrected or corr_corrected) , "Scale" (gamma, alpha or beta) and "qMF" (multifunctionality of order q).
When by_group
is not NULL
(i.e., the column name of the stratifying variable is specified),
an additional column with stratification variable (e.g., "country" of the plot pairs) is also shown after the plotID column. For species_data
is not NULL
,
the data.frame will show an additional column contain "Species.diversity" in the last column.
Examples
library(dplyr)
### Use data from five countries (data in Finland are excluded)
data("forest_function_data_normalized")
data("forest_biodiversity_data")
forest_function_data_normalized <- filter(forest_function_data_normalized, country != "FIN")
forest_biodiversity_data <- forest_biodiversity_data[-(1:48),]
MF2_multiple(func_data = forest_function_data_normalized[,6:32],
species_data = forest_biodiversity_data,
weight = 1,
by_group = "country")
### Use partial data to quickly obtain output
### (Take the first 18 plots in Germany and the last 18 plots in Italy)
data("forest_function_data_raw")
data("forest_biodiversity_data")
GER_ITA_forest_function_raw <- filter(forest_function_data_raw,
country=="GER"|country=="ITA")[c(1:18,57:74),]
GER_ITA_forest_function_normalized <- function_normalization(data = GER_ITA_forest_function_raw,
fun_cols = 6:31,
negative = c("soil_cn_ff_10","wue"),
by_group = "country")
GER_ITA_forest_biodiversity <- forest_biodiversity_data[c(49:82,181:229),]
MF2_multiple(func_data = GER_ITA_forest_function_normalized[,6:32],
species_data = GER_ITA_forest_biodiversity,
weight = 1,
by_group = "country")