View source: R/ecometric_model_qual.R
ecometric_model_qual | R Documentation |
Builds an ecometric trait space for qualitative environmental variables, estimating the most probable category and the probability of each category at each trait bin combination. Also calculates prediction accuracy and anomalies for each point.
ecometric_model_qual(
points_df,
category_col,
grid_bins_1 = NULL,
grid_bins_2 = NULL,
min_species = 3
)
points_df |
Output first element of the list from |
category_col |
Name of the column containing the categorical trait. |
grid_bins_1 |
Number of bins for the first trait axis. If |
grid_bins_2 |
Number of bins for the second trait axis. If |
min_species |
Minimum number of species with trait data per point (default = 3). |
A list containing:
points_df |
Filtered input data frame with the following added columns:
|
eco_space |
Raster-format data frame representing trait space bins with estimated environmental categories. |
diagnostics |
Summary stats about bin usage and data coverage. |
settings |
Metadata including the modeled trait. |
prediction_accuracy |
Overall percentage of correct predictions. |
# Load internal data
data("geoPoints", package = "commecometrics")
data("traits", package = "commecometrics")
data("spRanges", package = "commecometrics")
# Step 1: Summarize trait values at sampling points
traitsByPoint <- summarize_traits_by_point(
points_df = geoPoints,
trait_df = traits,
species_polygons = spRanges,
trait_column = "RBL",
species_name_col = "sci_name",
continent = FALSE,
parallel = FALSE
)
# Step 2: Run ecometric model using land cover class as qualitative variable
modelResult <- ecometric_model_qual(
points_df = traitsByPoint$points,
category_col = "vegetation",
min_species = 3
)
# View the percentage of correctly predicted categories
print(modelResult$prediction_accuracy)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.