Pre-modeling
Pre-modeling prepares everything a model needs: clean records, a calibration area, relevant predictors, training and testing sets, and, for presence-only data, background points or pseudo-absences. Decisions taken at this stage often influence the final maps more than the choice of algorithm.

The steps below follow the order of the Pre-Modeling menu.
1. Project directory
A project directory keeps inputs and outputs organized. Go to Pre-Modeling > Set Directory, choose a folder with Directory, and select:
- Calibrate area: create a folder for the calibration area;
- Algorithm: the algorithms you plan to fit. This list also defines the algorithms shown later in Modeling > Fitting;
- Ensemble: the method used to combine models.
Click Set up. nimo creates the following structure:
- 1_Inputs: occurrences (1_Occurrences), current predictors (2_Predictors/1_Current) and predictors for projections (2_Predictors/2_Projection), and the calibration area.
- 2_Outputs: model performance (0_Model_performance), and for current conditions and projections, one folder per algorithm and per ensemble method, each split into continuous (1_con) and binary (2_bin) predictions.

Even without saving files, select the algorithms here: they are needed in Modeling > Fitting.
2. Occurrence records and calibration area
Import the records in Pre-Modeling > Calibration as described in Occurrence data, or send them from the GBIF menu with Start modeling.
Why a calibration area?
The calibration area is the region the model learns from. It should contain the places the species could have reached and sampled (the M area of the BAM framework, Barve et al. 2011). It matters because:
- background points and pseudo-absences are sampled inside it;
- an area much larger than the species’ accessible area makes the model easy to “succeed” (most of the area is obviously unsuitable), inflating performance metrics;
- an area too small may exclude conditions the species could tolerate.
(Machado-Stredel et al. 2021; Velazco et al. 2022)
Defining the calibration area in nimo
- In the Geographic tab, click Add layer and select a vector file (shapefile or KML) with the boundary of your study region.
- Click Calibrate area and choose a method:
| Method | Description | Setting |
|---|---|---|
| Buffer | Circles of a given radius around each presence | Width (m) |
| Minimum convex polygon | Smallest convex polygon containing all presences | |
| Buffered minimum convex polygon | Minimum convex polygon enlarged by a buffer | Width (m) |
| Mask | Polygons of the vector layer that contain presences (for example ecoregions or protected areas) | Filter by: the field identifying the polygons |
- Click Calibrate. The last calibration validated is used in the following steps.




Calibration areas for Aardvark records in Pendjari National Park, with a 5000 m buffer where relevant.
3. Predictors
Predictors are the environmental variables used to explain the distribution: temperature, rainfall, elevation, vegetation index, land cover, distance to water or roads, and so on. Choose them from knowledge of the species’ biology: what limits its survival, reproduction and movement. A few relevant predictors usually give better and more interpretable models than many loosely related ones.
All layers must cover the study area. Ideally they share the same resolution, extent and coordinate system. If they do not, nimo aligns all layers on the first one (nearest neighbour resampling) and shows which layers were adjusted.
In Pre-Modeling > Predictors, click Predictor Folder and select the folder containing the GeoTIFF files. The Summary tab describes the layers, and the Plot tab displays the layer selected in Predictors when you click Show.

3.1. Reducing collinearity
Predictors are often correlated: temperature and elevation, or two rainfall variables. Strong correlation (collinearity) makes it hard to separate the effect of each predictor and makes models unstable, especially when they are applied to other areas or periods where the correlation may differ (Dormann et al. 2013).
Colinearize shows the pairwise relationships between predictors. The Reduce colinearity box offers four methods:
| Method | Principle | Setting |
|---|---|---|
| Pearson correlation | Removes one variable of each pair whose correlation exceeds the threshold | Threshold (0.7 by default) |
| Variance inflation factor (VIF) | Removes variables whose variance is strongly inflated by the others | Threshold (10 by default) |
| Principal component analysis (PCA) | Summarises the predictors into uncorrelated components explaining 95% of the variation | |
| Factor analysis | Keeps the variable most correlated with each factor |
The results appear in the Colinearity tab. Variables removed by the Pearson, VIF or factor analysis methods are left out of the extraction step by default.
These methods are aids, not a substitute for ecological reasoning: when two correlated variables are available, keep the one with the clearer biological meaning for the species.
3.2. Principal components as predictors
With the PCA method, the components can replace the original predictors. Click Use PCs as predictors: the components (PC1, PC2, …) are then used in every following step, including extraction, models and predictions. Use originals returns to the original predictors.
Components remove collinearity completely, but they are harder to interpret than the original variables: a response curve to PC1 is less meaningful than a response curve to temperature.

4. Environmental outliers
Some records have environmental conditions very different from the rest: coordinate errors, misidentifications, or individuals far from their usual range. Such records can distort the estimated niche (Chapman 2005; Liu et al. 2018).
Click Outliers in the Predictors page, then Detect. Presences are examined by five methods:
- Boxplot: values beyond 1.5 times the interquartile range of any predictor;
- Reverse jackknife: values unusually far from the others for a predictor (Chapman 2005);
- Support vector machine and random forest: presences that a model trained on presences and absences finds least similar to the other presences;
- Random forest outlier score: presences with an unusual position in the environmental space as measured by a random forest.
The support vector machine and random forest methods need absences, background points or pseudo-absences; with presences only, the three other methods are used.
The Map tab colours each presence by the number of methods that flag it; presences outside the predictor layers are shown as no data. The Methods tab counts the presences flagged by each method, and Flagged records lists them.


Choose the minimum number of methods (for example 3 of 5) and click Remove flagged to exclude those presences from the following steps. Keep all cancels the removal. Before removing records, check them: a record in unusual conditions may also be a genuine and valuable observation at the edge of the species’ range.
Coordinates must be in the coordinate system of the predictor layers.
5. Occurrence filtering
Sampling bias
Observers do not sample the landscape evenly. Records accumulate near roads, towns and research stations, so the model may learn the conditions of well-sampled places rather than the preferences of the species. Thinning the records, so that no two records are too close in geographical or environmental space, reduces this bias and the spatial autocorrelation between records (Varela et al. 2014).

Filtering in nimo
Click Filter in the Predictors page.
- Geographical filtering removes records closer than a minimum distance. The distance is set by one of three methods:
- Moran: the distance that minimizes spatial autocorrelation between records;
- Cellsize: a multiple (factor) of the predictor resolution;
- Defined: a distance in kilometres.
- Environmental filtering divides the environmental space into bins and keeps one record per bin, so records cover the range of conditions evenly. Number of bins sets how fine the division is.
Click Filter. The Distribution tab maps the kept records on a predictor; the Filtered data tab lists them.
Comparing several filtering values
Stronger filtering reduces bias but also removes information. To find a balance, type several values separated by commas, for example 2, 4, 8 for the cellsize factor, 1, 5, 10 km for a defined distance, or 4, 6, 8 bins. nimo filters the records with each value and selects the dataset that has a spatial autocorrelation below the average of all datasets and, among those, the largest number of records. The Selection tab compares them; the selected dataset is marked with *.

Using the filtered records
Click Use in analysis to continue with the filtered records: the spatial constraint, calibration area, partition and background sampling then use them. Don’t use returns to all records. Only presences are filtered; absences and background points are kept. Save exports the filtered records to a file.

Filtering is optional. With few records (for example fewer than 30), keep all of them or filter lightly.
6. Spatial constraint
A species may be absent from suitable areas simply because it never reached them, or because of factors not represented by the predictors. Such areas then appear suitable on the map: this is overprediction. Spatial constraint layers, built from the location of the presences and added to the predictors, help the model account for it (Mendes et al. 2020).
In the Spatial constraint (a priori) box of the Predictors page, choose a method:
- Latitude and longitude: two layers with the coordinates of each cell;
- Distance to closest record: distance from each cell to the nearest presence;
- Cumulative distance to records: sum of distances to all presences;
- Kernel density of records: density of presences around each cell.
Click Add constraint. The layer (for example msdm_min) is added to the predictors and can be selected for extraction and models. Remove takes it out.

Constraint layers are built from the same presences used to evaluate the models, so they can inflate performance metrics. Compare models fitted with and without the constraint, and prefer a spatial partition (section 7) when a constraint is used. Overprediction can also be corrected after modeling (see Post-modeling).
7. Partition: training and testing data
Why split the records?
To know whether a model predicts well, it must be tested on records it did not use for fitting. The records are therefore split into groups (folds): the model is fitted on some folds and tested on the others, and this is repeated so that every fold is used for testing once. Performance is then averaged.
When records are split at random, training and testing records are often close to each other and share similar conditions, which makes the test easy and the performance optimistic. Spatial partitions place training and testing records in different areas, which gives a more honest measure of how well the model predicts new places (Roberts et al. 2017).
Partition methods in nimo
In Pre-Modeling > Partition, choose the Partitioning type:
| Method | Principle | Main settings |
|---|---|---|
| Random: k-fold | Records split at random into k groups | Number of folds |
| Random: repeated k-fold | k-fold repeated several times with different splits | Number of folds, replicates |
| Random: leave-one-out | Each record is tested once against a model fitted on all others; for very small datasets | |
| Random: bootstrap | Records resampled with replacement for training, the rest for testing | Replicates, proportion |
| Spatial band | Latitudinal or longitudinal bands assigned to folds; the best number of bands is selected | Across, number of partitions, min and max bands |
| Spatial block | Square blocks assigned to folds; the best block size is selected | Number of partitions, min and max precision, number of grids |
| Environmental and spatial | Records grouped by k-means clustering in environmental space | Min and max groups |
For the spatial methods, nimo tests several configurations and keeps the one with the lowest spatial autocorrelation and the greatest environmental similarity between folds, while each fold keeps at least Min occurrence records. Proportion of points sets the share of records used for these tests.
Click Split to see the partition. For spatial bands and blocks, a map shows the folds.
8. Background points and pseudo-absences
This step is needed when Data type is Presence. A reminder box appears in the Partition page.
Background or pseudo-absences?
- Background points describe the conditions available in the calibration area. They suit methods that compare presences with the available environment, such as Maxent. Use many of them (several times the number of presences).
- Pseudo-absences are treated as absences. They suit methods that need absences, such as GLM, GAM or random forest. They work best when placed away from presences and in numbers similar to the presences (Barbet-Massin et al. 2012).
Sampling in nimo
After Split, click Sample and choose:
- Background:
- Random: uniform over the calibration area;
- Thickening: denser near presences, which reproduces the sampling bias of the presences in the background (Vollering et al. 2019); Width sets the radius.
- Multiply by: number of background points per presence.
- Pseudo-absence:
- Random: anywhere in the calibration area;
- Env constrained: in environmental conditions unlike those of the presences;
- Geo constrained: farther than Width from any presence;
- Env & Geo constrained: both constraints;
- Env clustering: geographically constrained and spread over the environmental space by clustering.
Points are sampled within each fold, in proportion to its number of presences. The window shows the sampled points, the updated records and their map.

Finally, click Validate to apply the partition to presences and the sampled points. Validation is required before extraction.
9. Extraction
The model needs, for each record, the value of every predictor at its location. In Pre-Modeling > Data extraction:
- Check Predictors to use. Variables removed by collinearity reduction are not selected by default; spatial constraint layers and principal components appear if they were added.
- Click Extract data.
Records falling where a predictor has no value are removed. The table shows the records with the partition column and one column per predictor; Save exports it. This table is the input of the models.

References
- Barbet-Massin, M., Jiguet, F., Albert, C. H., & Thuiller, W. (2012). Selecting pseudo-absences for species distribution models: how, where and how many? Methods in Ecology and Evolution, 3, 327-338.
- Barve, N., Barve, V., Jiménez-Valverde, A., Lira-Noriega, A., Maher, S. P., Peterson, A. T., Soberón, J., & Villalobos, F. (2011). The crucial role of the accessible area in ecological niche modeling and species distribution modeling. Ecological Modelling, 222, 1810-1819.
- Chapman, A. D. (2005). Principles and Methods of Data Cleaning: Primary Species and Species-Occurrence Data. Global Biodiversity Information Facility, Copenhagen.
- Dormann, C. F., Elith, J., Bacher, S., et al. (2013). Collinearity: a review of methods to deal with it and a simulation study evaluating their performance. Ecography, 36, 27-46.
- Liu, C., White, M., & Newell, G. (2018). Detecting outliers in species distribution data. Journal of Biogeography, 45, 164-176.
- Machado-Stredel, F., Cobos, M. E., & Peterson, A. T. (2021). A simulation-based method for selecting calibration areas for ecological niche models and species distribution models. Frontiers of Biogeography, 13, e48814.
- Mendes, P., Velazco, S. J. E., de Andrade, A. F. A., & De Marco, P. (2020). Dealing with overprediction in species distribution models: how adding distance constraints can improve model accuracy. Ecological Modelling, 431, 109180.
- Roberts, D. R., Bahn, V., Ciuti, S., et al. (2017). Cross-validation strategies for data with temporal, spatial, hierarchical, or phylogenetic structure. Ecography, 40, 913-929.
- Varela, S., Anderson, R. P., García-Valdés, R., & Fernández-González, F. (2014). Environmental filters reduce the effects of sampling bias and improve predictions of ecological niche models. Ecography, 37, 1084-1091.
- Velazco, S. J. E., Rose, M. B., de Andrade, A. F. A., Minoli, I., & Franklin, J. (2022). flexsdm: an R package for supporting a comprehensive and flexible species distribution modelling workflow. Methods in Ecology and Evolution, 13, 1661-1669.
- Vollering, J., Halvorsen, R., Auestad, I., & Rydgren, K. (2019). Bunching up the background betters bias in species distribution models. Ecography, 42, 1717-1727.
