ConsBiol-unibern / SDMtune

Performs Variables selection and model tuning for Species Distribution Models (SDMs). It provides also several utilities to display results.
https://consbiol-unibern.github.io/SDMtune/
Other
25 stars 8 forks source link

[Bug]: varImp and maxentVarImp plots are not comparable #32

Open rjaffe-ramboll opened 1 year ago

rjaffe-ramboll commented 1 year ago

Describe the bug

varImp returns a data.frame with two columns while maxentVarImp returns a data.frame with three columns. plotVarImp is simply plotting the first two columns, which are different. Plots are thus not comparable.

Steps to reproduce the bug

library(SDMtune)
## Calculate variable importance
vi1 <- varImp(maxent_model, permut = 10, progress = TRUE)
vi2 <- maxentVarImp(maxent_model)

## Plot variable importance
plotVarImp(vi1) # Plots Variable and Permutation_importance
plotVarImp(vi2) # Plots Variable and Percent_contribution

Session information

R version 4.2.0 (2022-04-22 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.utf8  LC_CTYPE=English_United States.utf8   
[3] LC_MONETARY=English_United States.utf8 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.utf8    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] blockCV_3.1-3       zeallot_0.1.0       plotROC_2.3.0       rJava_1.0-6         rasterVis_0.51.5   
 [6] lattice_0.20-45     predicts_0.1-8      stars_0.6-3         abind_1.4-5         mapview_2.11.0.9006
[11] geodata_0.5-8       sf_1.0-14           terra_1.7-39        rgbif_3.7.7         usethis_2.2.2      
[16] janitor_2.2.0       lubridate_1.9.2     forcats_1.0.0       stringr_1.5.0       dplyr_1.1.2        
[21] purrr_1.0.1         readr_2.1.4         tidyr_1.3.0         tibble_3.2.1        ggplot2_3.4.2      
[26] tidyverse_2.0.0     SDMtune_1.3.1      

loaded via a namespace (and not attached):
 [1] fs_1.6.2            satellite_1.0.4     oai_0.4.0           RColorBrewer_1.1-3  httr_1.4.6         
 [6] tools_4.2.0         utf8_1.2.3          R6_2.5.1            KernSmooth_2.23-20  DBI_1.1.3          
[11] lazyeval_0.2.2      colorspace_2.1-0    raster_3.6-23       withr_2.5.0         sp_2.0-0           
[16] tidyselect_1.2.0    leaflet_2.1.2       compiler_4.2.0      leafem_0.2.0        cli_3.6.1          
[21] xml2_1.3.5          labeling_0.4.2      scales_1.2.1        classInt_0.4-9      hexbin_1.28.3      
[26] proxy_0.4-27        digest_0.6.33       dismo_1.3-14        base64enc_0.1-3     jpeg_0.1-10        
[31] pkgconfig_2.0.3     htmltools_0.5.6     fastmap_1.1.1       htmlwidgets_1.6.2   rlang_1.1.1        
[36] rstudioapi_0.15.0   farver_2.1.1        generics_0.1.3      zoo_1.8-12          jsonlite_1.8.7     
[41] crosstalk_1.2.0     magrittr_2.0.3      interp_1.1-4        Rcpp_1.0.11         munsell_0.5.0      
[46] fansi_1.0.4         lifecycle_1.0.3     stringi_1.7.12      whisker_0.4.1       snakecase_0.11.0   
[51] plyr_1.8.8          grid_4.2.0          parallel_4.2.0      deldir_1.0-9        hms_1.1.3          
[56] pillar_1.9.0        codetools_0.2-18    stats4_4.2.0        glue_1.6.2          latticeExtra_0.6-30
[61] data.table_1.14.8   png_0.1-8           vctrs_0.6.2         tzdb_0.4.0          gtable_0.3.3       
[66] lwgeom_0.2-13       e1071_1.7-13        class_7.3-20        viridisLite_0.4.2   sfheaders_0.4.3    
[71] units_0.8-3         timechange_0.2.0

Additional information

No response

Reproducible example