Skip to contents

Shows the percent contribution and permutation importance of the environmental variables used to train the model.

Usage

maxentVarImp(model)

Arguments

model

SDMmodel or SDMmodelCV object trained using the "Maxent" method.

Value

A data frame with the variable importance.

Details

When an SDMmodelCV object is passed to the function, the output is the average of the variable importance of each model trained during the cross validation.

See also

Author

Sergio Vignali

Examples

# Acquire environmental variables
files <- list.files(path = file.path(system.file(package = "dismo"), "ex"),
                    pattern = "grd",
                    full.names = TRUE)

predictors <- terra::rast(files)

# Prepare presence and background locations
p_coords <- virtualSp$presence
bg_coords <- virtualSp$background

# Create SWD object
data <- prepareSWD(species = "Virtual species",
                   p = p_coords,
                   a = bg_coords,
                   env = predictors,
                   categorical = "biome")
#>  Extracting predictor information for presence locations
#>  Extracting predictor information for presence locations [21ms]
#> 
#>  Extracting predictor information for absence/background locations
#>  Extracting predictor information for absence/background locations [45ms]
#> 

# Train a Maxent model
# The next line checks if Maxent is correctly configured but you don't need
# to run it in your script
model <- train(method = "Maxent",
               data = data,
               fc = "l")

maxentVarImp(model)
#>   Variable Percent_contribution Permutation_importance
#> 1     bio1              48.4267                 0.0000
#> 2    biome              36.7933                 7.0174
#> 3     bio8               7.3643                21.7752
#> 4     bio6               2.6993                56.4936
#> 5     bio7               2.5507                 0.0000
#> 6    bio16               1.2838                 0.0000
#> 7    bio17               0.5727                 0.0000
#> 8    bio12               0.2764                14.2192
#> 9     bio5               0.0328                 0.4946