ecometric_space_qual {commecometrics}R Documentation

Plot ecometric space for qualitative environmental variables

Description

Visualizes the predicted ecometric space (predicted category) and probability maps for each category based on the output from ecometric_model_qualitative().

Usage

ecometric_space_qual(
  model_out,
  category_labels = NULL,
  palette = NULL,
  fossil_data = NULL,
  fossil_color = "#000000",
  modern_color = "#bc4749",
  x_label = "Summary metric 1",
  y_label = "Summary metric 2"
)

Arguments

model_out

Output from ecometric_model_qualitative(), containing environmental estimates in trait space.

category_labels

Optional named vector for category labels (used in the legend title). If NULL, the unique strings in the predicted category column (env_est) will be used as-is.

palette

Optional color vector for categories (must match number of categories).

fossil_data

Optional. Output from reconstruct_env_qual().

fossil_color

Outline color for fossil data bins (default = "#000000").

modern_color

Outline color for modern data bins (default: "#bc4749").

x_label

Label for the x-axis in the output plots (default: "Summary metric 1").

y_label

Label for the y-axis in the output plots (default: "Summary metric 2").

Value

A list containing:

ecometric_space_plot

ggplot showing the predicted category across trait space.

probability_maps

List of ggplots showing probability surfaces for each category.

Examples


# Load internal data
data("geoPoints", package = "commecometrics")
data("traits", package = "commecometrics")
data("spRanges", package = "commecometrics")
data("fossils", package = "commecometrics")

# 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
)

# Run ecometric model for qualitative variable
modelResult <- ecometric_model_qual(
  points_df = traitsByPoint$points,
  category_col = "vegetation",
  min_species = 3
)

# Reconstruct fossil environmental categories
reconQual <- reconstruct_env_qual(
  fossildata = fossils,
  model_out = modelResult,
  match_nearest = TRUE,
  fossil_lon = "Long",
  fossil_lat = "Lat",
  modern_id = "ID",
  modern_lon = "Longitude",
  modern_lat = "Latitude"
)

# Plot qualitative ecometric space
ecoPlotQual <- ecometric_space_qual(
  model_out = modelResult,
  fossil_data = reconQual
)

# Display predicted category map
print(ecoPlotQual$ecometric_space_plot)

# Display one of the probability maps
print(ecoPlotQual$probability_maps[["1"]])


[Package commecometrics version 1.0.0 Index]