Skip to content

jeffreyevans/Croatia_sdm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

Croatia SDM's version 0.01 (11/04/2023)

Croatia's Biom Species Distribution Models.

Description of model code files

  1. 01_make_spp_data.R – This reads the spreadsheets (contained in the “spp” directory, performs the filtering and writes a shapefile into a new directory in “SDM” that will contain the model results. I made the naming convention(s) fairly straight forward and defined by variables at the beginning of each file so, the should be easy to change. The data from the excel files that is written to each shapefile is named after the species and has the following columns: y", "obs_type", "species", "nobs", and, "dttm". The “y” column contains a binominal value for presence/absence and “obs_type” represents the data type being, “pres” and “real abs”.

  2. 02_create_sdm_covariates.R –I am not sure if you will use this or not but, it is a script for downloading raster data, projecting, and masking it to the project area. Following the logic of the rest of the code, the raster covariates are contained in a directory called “data”, one level down from root. The source resolution, or processed, resolution is 100m2. I believe the code is fairly clear so, should be adaptable in creating new data. The rasters currently in the data directory are:

  3. 03_croatia_sdm.R - There are some variables at the beginning of the script that can be changed to customize directory structure and model parameters. The pseudo absence data is created following the same column naming convention and is then merged with the spp data. The “obs_type” for pseudo absence is encoded as “pseudo abs”. The raster data is assigned to the resulting merged data is what is used in the model and is written out to a separate shapefile “traning_data.shp”. I am screening for observations that fall in the same pixel(s) and dropping the zero value if it cooccurs with a 1 else, it is the first duplicate observation. The data is screened for collinearity/multicollinearity and a parameter significance tests and model selection applied. I then apply an optimize fit based on prediction variance (only on the zero class) and a final model fit. Class imbalances is accounted for in each model based on a fractional Bootstrap sample associated with each class. The spatial prediction outputs a raster “spp_results.tif” that contains the probabilities and classified raster. The probability threshold derives 4 methods and averages the results. There seems to be fairly good agreement so, disparity is not expected. Model plots are output to “SDM_model.pdf” and the model object is saved as “SDM_model.RData”. I still need to add the cross-validation, to evaluate performance, and write out a validation report but, things are looking good. There is a standard error plot in the pdf.

Other code

  1. accuracy.R – Modification of rfUtilities function which provides validation metrics based on confusion matrix

  2. check.packages.R - Checks if required libraries are installed and adds them if not in library. Also defines library environment and mirror. Can be used to simply add required libraries to current R environmnet.

  3. occurrence.threshold.R - Modification of rfUtilities function to include log loss as option

Contact:

Iva Mihalić BIOM, Croatia iva.mihalic@biom.hr

Louie Taylor BIOM, Croatia louie.taylor@biom.hr

Jeffrey S. Evans, Ph.D. Senior Landscape Ecologist & Biometrician The Nature Conservancy | Global Protect, Science jeffrey_evans@tnc.org

About

Model for Croatia Biom SDM's

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages