itsdm calls isolation forest and variations such as SCiForest and EIF to model species distribution. It provides features including:

  • A few functions to download environmental variables.
  • Outlier tree-based suspicious environmental outliers detection.
  • Isolation forest-based environmental suitability modeling.
  • Response curves of environmental variable.
  • Variable importance analysis.
  • Presence-only model evaluation.
  • Method to convert predicted suitability to presence-absence map.
  • Variable contribution analysis for the target observations.


Install the CRAN release of itsdm with

You can install the development version of itsdm from GitHub with:

# install.packages("remotes")


This is a basic example which shows you how to solve a common problem:


# Using a pseudo presence-only occurrence dataset of
# virtual species provided in this package

# Split to training and test
occ_virtual_species <- occ_virtual_species %>%
  mutate(id = row_number())
occ <- occ_virtual_species %>% sample_frac(0.7)
occ_test <- occ_virtual_species %>% filter(! id %in% occ$id)
occ <- occ %>% select(-id)
occ_test <- occ_test %>% select(-id)

# Get environmental variables
env_vars <- system.file(
  package = 'itsdm') %>% read_stars() %>%
  %>% slice('band', c(1, 6, 12, 15))

# Train the model
mod <- isotree_po(
  occ = occ, occ_test = occ_test,
  variables = env_vars, ntrees = 200,
  sample_rate = 0.8, ndim = 2L,
  seed = 123L)

# Check results
## Suitability
ggplot() +
  geom_stars(data = mod$prediction) +
  scale_fill_viridis_c('Predicted suitability',
                       na.value = 'transparent') +
  coord_equal() +

## Plot independent response curves
  target_var = c('bio1', 'bio12'))


This package is part of project “Combining Spatially-explicit Simulation of Animal Movement and Earth Observation to Reconcile Agriculture and Wildlife Conservation”. This project is funded by NASA FINESST program (award number: 80NSSC20K1640).