null.model: Compute null model

View source: R/null.model.R

null.modelR Documentation

Compute null model

Description

Compute null model. Null models are useful tools to highlight an a priori evaluation of the influence of presence records spatial structuration in model predictions (i.e. influence of aggregated sampling).
Null model type #1 performs a model by randomly sampling locations from the ensemble of visited stations, therefore simulating the influence of sampling effort on model predictions.

Null model type #2 samples data in the entire study area, and reflects what should be predicted if occurrences were randomly distributed in the area.

Models should be replicated nb.rep times in order to estimate statistical scores.

Usage

null.model(predictors, xy = NULL, type = c(1, 2), algorithm = c("brt", "maxent"), nb,
         unique.data = T, same = T, background.nb = nb, nb.rep = 10, tc = 2,
         lr = 0.001, bf = 0.75, n.trees = 50, step.size = n.trees)

Arguments

predictors

Rasterstack object that contains the predictors that will be used for species distribution models

xy

Dataframe that contains the longitude and latitude of the visited pixels. Information required to perform type 1 null model. Default= NULL

type

Null model type to perform. type=1 to perform a null model based on visited areas, type=2 to predict random model

algorithm

Algorithm to compute the null model. 'brt' or 'maxent'

nb

Number of points to randomly sample (among the matrix of visited pixels for 'type=1' model or in the entire geographic space for 'type=2')

unique.data

If TRUE (default), pixel duplicates contained in 'xy' are removed

same

If TRUE (default), the number of background data sampled in the area will be 'nb'

background.nb

Number of background data to sample. If this argument is filled, 'same' is set FALSE.

nb.rep

Null models number of replicates. See compute.brt

tc

BRT parameter. Integer. Tree complexity. Sets the complexity of individual trees. See compute.brt

lr

BRT parameter.Learning rate. Sets the weight applied to individual trees. See compute.brt

bf

BRT parameter.Bag fraction. Sets the proportion of observations used in selecting variables. See compute.brt

n.trees

BRT parameter.Number of initial trees to fit. Set at 50 by default. See compute.brt

step.size

BRT parameter.Number of trees to add at each cycle. See compute.brt

Details

Data are sampled without replacement. Each time the model is runned, new data (presence and background data) are sampled

Value

List of 6

  • $inputs Remembers the arguments used to implement null.model function

  • $eval Evaluation parameters of each model that compose the null model. See SDMeval for further information

  • $eval.null Evaluation of the mean null model. See SDMeval for further information

  • $pred.stack RasterStack of all the models produced to build the null model

  • $pred.mean Raster layer. Null model prediction. Mean of the $pred.stack RasterStack

  • $correlation Spearman rank test value between the different maps produced

Note

Increasing the number of replications will enhance model null relevance (we advice nb.rep=100 for minimum). Please note that processing may take few minutes to hours.

If you want to build a MaxEnt model, compute.maxent uses the functionalities of the maxent function. This function uses MaxEnt species distribution software, which is a java program that could be downloaded at https://github.com/charleneguillaumot/SDMPlay. In order to run compute.maxent, put the 'maxent.jar' file downloaded at this adress in the 'java' folder of the dismo package (path obtained with the system.file('java', package='dismo') command). MaxEnt 3.3.3b version or higher is required.

See Also

nicheOverlap: compare prediction maps .jpackage: initialize dismo for Java

Examples

## Not run: 
# Load environmental predictors
data(predictors2005_2012)
envi <- predictors2005_2012
envi

# Realise a null model type #2 with BRT
#--------------------------------------
modelN2 <- SDMPlay:::null.model(xy=NULL,predictors=envi,type=2,algorithm='brt',
                     nb=300,unique.data=TRUE, same=TRUE, nb.rep=2,lr=0.0005)

# Look at the inputs used to implement the model
modelN2$input

# Get the evaluation of the models produced
modelN2$eval

# Get the evaluation of the mean of all these produced models (i.e. evaluation
# of the null model)
modelN2$eval.null

# Get the values of Spearman correlations between the all the prediction maps produced
modelN2$correlation

# Plot the mean null model map with nice colors
library(grDevices)
palet.col <- colorRampPalette(c('deepskyblue','green','yellow', 'red'))(80)
data('worldmap')
raster::plot(modelN2$pred.mean, col=palet.col)
points(worldmap, type="l")

## End(Not run)

charleneguillaumot/SDMPlay documentation built on Feb. 2, 2023, 1:09 p.m.