sdm R package: species distribution modelling
HTML-код
- Опубликовано: 21 авг 2024
- I recorded this video from my screen while I was explaining the solutions for an assignment I prepared for MSc students in the course global ecology and biodiversity at the University of Amsterdam. The assignment was about using the sdm package in R for modelling the geographical distribution of a species (Linx pardinus) in the current and future time given climate data. You can find the PDF file of the assignments as well as the data used in this video in the folder shared via the following Dropbox link:
www.dropbox.co...
sdm is an R package that is is a reproducible and extensible framework for species distribution modelling. You can find more information from the following link:
www.biogeoinfor...
Good luck,
Babak Naimi
Thank you Babak. very helpful video here. Exactly what I was looking for!
Thank you so much sir for sharing this video....you always try to help others...
very helpful tutorial specially for research scholars working in sdm domain.
Thank you for providing such material! It helped me a lot!
Thanks for sharing. Wonderful
Thanks for sharing this with us! Very good tutorial
Good to see the mapview function in application.
Amazing! Thank you so much for your master class!
Thank you so much, this video is so practical and helpful!!! Amazing interaction-GUI, I like the mapview() too
Thank you so much for all your help!
FIY In the case of bootstrapping p-values for tests at the 0.05 the minimum number of samples is about 400 (so 399) while for a test at the 0.01 level it is 1500 so (1499).
Great tutorial ever
Thanks for the great tutorial.
Have one question, how do I evaluate the ensemble model outcome(en)?, AUC, TSS and other stuffs.
more video on analysis like this please... thank you
I have been able to run the code with my data for my preliminary trials using lower bootstrap counts (
I'm having the same issue for Prediction (Error in o[[id[j]]] : subscript out of bounds). Any Solution ?
Thank you so much for this video. I love it. Is it possible to get the coordinates of both the presence and pseudo absence using the sdmData function? I want to plot a graph of absence and presence for my species distribution before I start the analysis.
Yes, you can use the coordinates function to get the coordinates.
@@babaknaimi OKay, thank you.
Thanks for the fantastic video! Is there a way to define the extent over which you would like to generate predictions? For instance, if I am only interested in predicting suitability over the United States, is there a way to to this in the model (to save on run time)?
You can simply use the predictors cropped within the United States as the newdata in the predict or ensemble function to get the predicted values for a specific area.
you should start with the libraries that you are using to put the audiance in perspective of whatever workflow you are embarking on.
You right, however, this video was prepared for the students who were in my class, so they know the background and all the concepts behind whatever is discussed here. I just thought it might be useful for others who started exploring the sdm package and have some background.
very useful video, thanks alot
Thank you so much for this great video.
Is the same process for categorical variable also?
And the Maxent? How we can implement Maxent in sdm package?
thank you for sharing this video, I wonder whether raster::getData()function downloading the present data?
Hi Babak,
Thanks for sharing this great tutorial. Any idea on how to generate partial dependence plots for predictor variables within the sdm package?
Thank you for sharing it @Biogeoinformatics !! It is amazing!
I was wondering while watching, would it be possible to predict suitability for agriculture production using sdm? In this case how could I adapt my case which is a polygon (large area of production) rather than points (single lat, and long) ?
Thank you very much again.
Subscribed √
I think you can simply generate random points over the polygons and assign the value of 1 to them. Then, you can add bg argument to the sdmData function (as I did in the video) to generate the background points (0s) over whole the study area randomly. I believe it would give you the suitability map you need.
@@biogeoinformatics That is what I thought. I will try it out. Thank you again
Hello sir, First of all thank you so much for uploading this tutorial. it was very helpful. Sir i have a doubt sir here we are using CMIP5 DATA instead for uploading CMIP6 future climate data what should we do .
Hello :)
I have downloaded occurrence data manually from gbif and stored it in my directory as a .cvs file. I already read the records into r and started cleaning the data. I removed duplicated records and the records without coordinates. Now I wanted to keep only the records that are over the extent of my study area, which is part of south america. Any inputs on how do I do that? Nothing I tryed worked out...
Thank you for the great video and step-by-step explanation! Great help to get started. :)
I am trying to follow but get stuck on the sdm() function.
My code reads:
m
same here, maybe did you solve the problem????
At the same point I had the same problem. Check the following points:
If you are getting this error, when you run the getmethodNames('sdm') code, it means some packages are not installed. You should determine which packages are missing and install the missing ones.
Check the required packages below:
library(sdm)
getmethodNames('sdm')
Loading required package: sp
sdm 1.0-89 (2020-04-22)
Loading required package: dismo
Loading required package: raster
Loading required package: gbm
Loaded gbm 2.1.8
Loading required package: tree
Loading required package: mda
Loading required package: class
Loaded mda 0.5-2
Loading required package: mgcv
Loading required package: nlme
Attaching package: ‘nlme’
The following object is masked from ‘package:raster’:
getData
This is mgcv 1.8-33. For overview type 'help("mgcv-package")'.
Loading required package: glmnet
Loading required package: Matrix
Loaded glmnet 4.0-2
Loading required package: earth
Loading required package: Formula
Loading required package: plotmo
Loading required package: plotrix
Loading required package: TeachingDemos
Loading required package: rJava
Loading required package: RSNNS
Loading required package: Rcpp
Loading required package: randomForest
randomForest 4.6-14
Type rfNews() to see new features/changes/bug fixes.
Loading required package: rpart
Loading required package: kernlab
Attaching package: ‘kernlab’
The following objects are masked from ‘package:raster’:
buffer, rotated
Thank You so much!!!...
Hi! thank you so much for the great video!^^
Is that possible to create a background points radius (buffer) around the presence data?
Thanks for posting this video, very helpful. I have a question about using Maxent as a model when setting up the sdm. Under the getmethodNames(), maxent is listed as an option. I have downloaded the required packages and can run the maxent as a stand alone. However, when I attempt to select it as a model, it will return only NA and says the maxent did not run. Do you know how to incorporate this into the series of models? Thanks
Did you put the maxent.jar file in the right place (or in the working directory for the first time you use maxent method)?
@@babaknaimi Thanks for getting back to me. I have used.
jar
@@alexkiser4017 This returns the location of the folder where the file should be located. You need then check file.exist(jar) and if it is TRUE, then it should work. Alternatively, you can simply put maxent.jar in the working directory where you fit the sdm function (only for the first time), then the sdm function copies the file into the right location. It should work then if rJava and dismo are installed appropriately. Good luck
Hi Babak - great video! I am struggling to get maxent to work with this sdm package. The maxent model completes training but when I apply predictions, I get the following error message: "Error in .local(object, ...) : Error in prediction....!" Any idea why that error is occurring?
Hi, good afternoon. I was wandering if is possivel to create a sdmdata with two independent data set, one for training and the other for testing. I try to do it but it gave this error and i´m having troubel to correct it:
prueba
Hi,
I encountered the same problem. Did you find a solution?
Hi Mr. Naimi, I used the sdm package but I am encountering an error in the predict function after I changed one variable as a factor in the sdmData function and the model.
The error is Error in names(x)
Here is a copy of my script.
# MODEL TRAINING
d
Sorry, I have no idea about this error. Without looking at a reproducible code, it would be difficult to understand what caused the error.
@@biogeoinformatics Thank you for the quick response.
I have solved the initial error although another one popped up.
p1
Dear Dr. Babak Naimi,
Thank you for your very teachable tutorial. please could you get me the scripts you are using on this live tutorial? Thank you.
Can you tell me what the meaning of the '10 criteria' at 28:36 ? I cannot find any information regarding to it.
This refers to the threshold optimisation criteria that would be used to find the best threshold for converting the predicted probability of occurrence to presence-absence value. The sdm package uses 10 different criteria to find the threshold. For example, the second criterion (max[sensitivity+specificity]) finds the threshold under which the value of specificity + sensitivity is maximised (i.e., TSS is maximised). The threshold for each criterion is then used to calculate different metrics (e.g., sensitivity, specificity, TSS, Kappa, etc.) that are presented in the threshold-dependent table.
Could you please let me know how I can plot the factor variable for instance landcover using rcurve() function of sdm package. Thanks.
if you have the landcover variable used in the model as a factor, the rcurve generates the response as a barplot
Do we need to do the vifcor() for the CHIP5 variables? and see if the variables are collinear?
No, you check this for the variables that you use to fit SDMs.
@@babaknaimi Thank you so much
Firstly, Thank you very much for the tutorial.
I just have a question regarding the ensemble function and the predict funtion. I have the packages loaded but I get this message when the command is done running.
Error in .getGDALtransient(x, filename = filename, options = options, :
filename exists; use overwrite=TRUE
"Error in .getGDALtransient(x, filename = filename, options = options, :
filename exists; use overwrite=TRUE
In addition: Warning message:
In .local(x, newdata, filename, ...) :
method is not identified, therefore the default ("weighted") is considered!"
if anyone knows why I am getting the error please let me know.
Hi, when you specify a filename that already exists, you get such error unless you add the argument, overwrite = T;
In the setting arguement in the ensemble function, you can specify the method = "weighted" or "unweighted", if you specify something else, "weighted" is considered.
Hi! Does someone know why I have such an error after trying to use predict function?
Error in .updateGDAL(object, v, cell, band, setminmax) : no longer supported
It is because of the changes in GDAL library. I am fixing in the new version. Meanwhile, you may use the native raster format in the raster package, a file with extension of .grd
Hello Sir, I am new to R. I want to do an SDM (GLM) for vulture species with its presence points only w.r.t. predictable variables, of which I have the raster layers. Kindly help me to do it in R.
ruclips.net/p/PLscTjKy2_0Klj6j5t7GD4BZ_MUQ3nJEOw
hello sir, this was very helpful for me. The prolem is I am not getting all the ML methods in getmethodNames() like svm,cart,rf. Please help me to add them into mine.
Use installAll() to install all the required packages
Is possible to save the object d and m to save time for other session?
Yes, you can use the function write.sdm. Then read.sdm can be used to read them back.
Yes, you can use the function write.sdm to save the objects, and later use the read.sdm function to read them back.