plot_importance {enmpa}R Documentation

Plot variable importance

Description

Visualization of the results obtained with the function var_importance.

Usage

plot_importance(x, xlab = NULL, ylab = "Relative contribution",
                main = "Variable importance", extra_info = TRUE, ...)

Arguments

x

data.frame output from var_importance.

xlab

(character) a label for the x axis.

ylab

(character) a label for the y axis.

main

(character) main title for the plot.

extra_info

(logical) when results are from more than one model, it adds information about the number of models using each predictor and the mean contribution found.

...

additional arguments passed to barplot or boxplot.

Value

A plot

Examples


# Load species occurrences and environmental data.
data("enm_data", package = "enmpa")

# Custom formulas
forms <- c("Sp ~ bio_1 + I(bio_1^2) + I(bio_12^2)",
           "Sp ~ bio_12 + I(bio_1^2) + I(bio_12^2)")

# Fitting models
fits <- fit_glms(forms, data = enm_data)

# Variable importance for single models
vi_1 <- var_importance(fits$ModelID_1)
plot_importance(x = vi_1)

vi_2 <- var_importance(fits$ModelID_2)
plot_importance(x = vi_2)

# Variable importance for multiple models
vi_c <- var_importance(fits)
plot_importance(x = vi_c)

[Package enmpa version 0.1.8 Index]