sdm: a reproducible and extensible R package for species distribution modelling
Вставка
- Опубліковано 7 гру 2024
- This is a lecture, followed by a practical session, about species distribution modelling and the sdm R package that has been developed by Babak Naimi and Miguel Araujo. This material was part of the ENM2020 online course that was organised by Town Peterson, and therefore, the video is available in the ENM2020 course channel as well ( • ENM2020 - W20T1 - sdm . The same video, however, is uploaded here for the subscriber and followers of the Biogeoinformatics channel.
Link to the article about the sdm R package published in Ecography:
onlinelibrary....
To download the R script written during the live demo, use the following link:
www.dropbox.co...
-------------------------------
For more information about me (Babak Naimi; the main author and developer of the sdm R package), please look at the following websites/links:
Homepage I: biogeoinformati...
Homepage II: r-gis.net
Google Scholar: scholar.google...
GitHub: github.com/bab...
Twitter: / babaknaimi
LinkedIn: / babak-naimi-73026341
ORCiD: orcid.org/0000...
thank you very much I was very lost in the part of quantifying the importance of bioclimatic variables and your video helped me a lot
Very nice to see another helpful tutorial on SDM package, Thank you dear Naimi. Can you please present a tutorial on predecting plant functional traits from an existing plant distribution models? Thank you in advance.
It is possible? How can we do this? very interesting.
Great!! Video could you please make a video on the Biomod2 package?
thanks for Sharing, really appreciate for newbie like me
Thank you so much for your great video!
Thank you for the great tutorial. Have one question, how to calculate the threshold maximizing the TSS/the maximum training sensitivity plus specificity threshold?
Thank you sir for making this useful video. I face error while trying to (raster)extractspg and bioc together
Really love this thank you
Great video!, I have a question, how can i do a fine tuning and parameter selection for models such as glm, gam, rf and maxent?
Thanks for the great tutorial.
Have one question, how do I evaluate the ensemble model outcome(en)?, AUC, TSS and other stuffs.
You can use the evaluates function, put the sdmdata object as the first argument, and the raster output of ensemble as the second argument
@@biogeoinformatics
thanks for the reply :)
but have another question.
I successfully ran the model, now looking through the outcomes and have one question.
In the variable importance, is the metric based on the jackknife approach?
and if not how are correlation test and auc test done?
Great SDM tool!
Hi, great video!
Question - is there anyway to deal with spatial auto correllation (the presence of systematic spatial variation in a variable) with this package?
Thank you
Thanks a lot for this tutorial. It really helped me to publish my first SDM using R, well appreciated. One question: Is there any code that I can use to split the response curve?. For example, instead of having 9 curves in one row, is it possible to have 3 rows (every 3 curves in one row). Thanks a lot.
I'm having issues with spatrasters working in the ensemble function. The example code in the help section also runs into the same error. Any ideas on how to fix this?
p2
Thank you Sir but if I run df
Hi, is there a way to bring in our own bias file that we created with sdmtools? it is asc file
By entering the density of occurrence of the species at certain points, I want to predict the density at which they can be seen at other points. Is this possible? Can you suggest any method?
Thanks a lot, it is a great job. I need some help please, it is very important for my PhD research work. I want to download Historical monthly weather data from Worldclim for 2010-2018 time period. And use this data for current prediction. Do you know R scripts for this data? Or how I can change CMIP5 data to CMIP6 weather data? Thanks in advance.
your doing a phd and cant use your brains to ask your academic staff
How do you incorporate other form of measurements outside presence/absence like abundance or any measurement like species density in this model?. Wondering if its the same or there are major changes to follow?
How can we get evaluation for ensemble one TSS and ROC vakue ?
Can’t we used the uncropped predictors in prediction?
Can an r3PG model be included in an sdm model in R?
please help me, how can i fix "Error: cannot allocate vector of size 12.0 Gb"
Error in loadNamespace(x) : there is no package called ‘devtools’ ............ how can I install Babknaimi sdm to my r studio
p
SIR i need help. Kindly share your suggestion
Iam using R 4.1.3
SDM was running properly but now predict function not working. An error appearing
p1
I am updating the package but meanwhile, you may use a raster format with extension of .grd, so use:
p1
@@babaknaimi I Tried .grd extension but it shows( Error in o[[id[j]]] : subscript out of bounds). Any Solution :)
@@babaknaimi hi! I have the same problem. Is there any update yet, or any planned date? Thank you very much!
Kindly add a new video as we have now CMIP 6 data.
Anyone else having trouble using predict function for maxent algorithm?
Me . Did you find any solution to that?
Grear presentation
brilliant tutorial! Apologies if I missed this, but do where can I find the code used in this tutorial? Thanks so much
I practiced the code so I have it in .R file. Let me know if you need it.
@@zainulabdin4466bro i need it. It will be very helpful if you are able to provide me the code
Hello! I've been trying to figure out if you can plot the randomly generated background pseudo-absences from the sdmData object, but have yet to find or figure it out. Can someone help me, if it is indeed possible? Would be cool to see how the function is generating the new data. Thanks in advance.
Once you have the output of sdmData object, say d, you can convert it to data.frame object, extract species and coordinates columns, and filter where species == 0.
df
Thank you for this video. May someone kindy assist, i am get this error trying to get slot "presence" from an object of a basic class ("NULL") with no slots in the modelling step
My guess is that your input data (generated by sdmData) is presence-only. Put the setting in the bg argument in the sdmData to have background generated
@UCqDtax1iPvWGBm-BGvraORA I would check the column names in points (make sure you would have one column contains presences as 1), also check d object to see if the name of species is the same as you used in formula in the sdm function
@@babaknaimi Thank you so much, it works now. I truly appreciate it, sir.
thank you very much for this.. a little confusion with the gui(m) code though.. Which package needs to be installed for this code to work? I got lost at that point..
Actually I got the code to run but it keeps running for eternity and I have to abort r in order to stop it.. so there's a little problem.. not sure what makes it behave this way..
You can simply run installAll() which installs all required packages including those required by gui (gui requires shiny).
@@yadavghimirey I also think you are returning to console before closing the open shiny gui. You need to close the shiny gui first then come back to R console to continue with other codes.
@@biogeoinformatics Thank you very much
@@wyclifeoluoch9376 Thx! :)
Hi, I have a problem in coding as "sp" is my occurrence, vars are selected bioclimatic variables after the collinearity check.
data
Convert sp to a SpatialPointsDataFrame
Thanks, It's work now!
May someone please help. Does anyone know how to get the rcurve for the ensemble model?
I will add the possibility in the new version
I am working to model species distribution using R with HP pc, Cori 7, 8th generation, RAM 8GB, processor 1.99 GB , while my PC does not give results. What is the minimum capacity of PC to run SDM?
I got i5 9th gen and it works perfectly fine for me.
How would you go about using the sdm function for more than 1 species? I provide the function an sp object with the coordinates but with a column with the species names instead of the occurrences being "1". The sdmData object runs smoothly and recognizes the number of species there. However, in the sdm function I use the same column and the sdmData object and I get an error:
"Error in FUN(X[[i]], ...) :
trying to get slot "presence" from an object of a basic class ("NULL") with no slots"
Did you generate background, i.e., put, for example, the bg=list(n=1000) argument in the sdmData function?
@@biogeoinformatics thank you for the reply! Yes, I have the background data stated in the sdmData object
@@franciscoborges1590 so, then please send the output of running head function on your input data: head(XXX), and the sdmData code you used that caused the error
@@biogeoinformatics The data I'm inputting for the sdmData is has the following head:
head(occ1)
" Species
1 maritima
2 maritima
4 maritima
5 maritima
6 maritima
7 maritima""
This was created from a dataframe with three columns: Species ; Longitude ; Latitude, and assigning the coordinates function. I believe this could be where my mistake lies but I'm unsure where.
The sdmData code lies below:
d
Hi Franciso, Not sure if you've got it sorted already but I had the same problem. Convert the 'species' names into numbers and it runs properly!
Hi! I'm having a repetitive error related to the 'newdata' part in the prediction. I followed every step in the tutorial, but it gives me:
d
It was a problem in the predict function that has been fixed in the new version. Install the latest version of the sdm package!
@@biogeoinformatics Thank you, it solved the problem of the matching number of cells, but now when I run the models (m), Maxent models don't work but the rest of the algorithms work, can you give me an insight on that?
@@felipeespinoza8647 Maxent requires rJava in R and Java on your machine (OS). You need to first install JDK on your machine (not within R; on your operating system), then it should work. You may need to restart R. You can download JDK from here: www.oracle.com/java/technologies/downloads/
I did that already, and it as working, but after installing the latest version I get this error:
> m2 m2
class : sdmModels
========================================================
number of species : 1
number of modelling methods : 1
names of modelling methods : maxent
replicate.methods (data partitioning) : subsampling
number of replicates (each method) : 3
toral number of replicates per model : 3 (per species)
test percentage (in subsampling) : 30
------------------------------------------
model run success percentage (per species) :
------------------------------------------
method species
----------------------
maxent : 0 %
###################################################################
Error in if (wtest == "test.dep") cat("model Mean performance (per species), using test dataset (generated using partitioning):
") else if (wtest == :
missing value where TRUE/FALSE needed
Hi Everyone, did anyone tried running this -- m
In your code, there is no sense in using parallel as you only have one method and one replication, though I don't think it is the reason for crashing. It could be related to the Java run time, rJava, or even lack of memory. The first step is to see if it works appropriately in a non-parallelised code
@@biogeoinformatics Thank you for your response - I tried the code without parallel and just kept maxent it crashed as well.
The R studio crashes without any error message (only when maxent is added in the code) for other methods the code works well.
At last I ran the script in R (not studio) the code worked. Surprisingly the same thing is not working in studio. I was able to run the script in R 4.2.2.
Thank you for this efficient code !
I am using the {sdm} package to do the species distribution modelling of invasive species. The {vifcor} was done succesfully and the variables(rasters) with high correlation were excluded. I am unable to compile my rasters(bioclim variables, elevation , ndvi) , occurance data into the {sdmData} object. Below is my code and error.
d sp
Convert your species data to a SpatialPointsDataFrame
@@babaknaimi class(sp)
[1] "data.frame"
Sir can you please tell me the code used for it
@@babaknaimi
I have converted species data to spatial data frame sir > class(spwc)
[1] "sf" "data.frame"
> spwc
Simple feature collection with 32 features and 1 field
Geometry type: POINT
Dimension: XY
Bounding box: xmin: 76.64554 ymin: 10.49855 xmax: 76.74306 ymax: 11.0425
CRS: NA.
But even now I am facing issue sir
> d
You need to convert it to SpatialPointsDataFrame (not sf)
coordinates(sp)
When I try to "filter function", I take an error "%>%" function is not found. How can I fix it.
you probably need to install dplyr
I want sdm code quickly pls
SIR I HAVING THE ISSUE IN THE CROPING STEP spg