We need to check that model fitting in sdm.R is working.
I generalized the code. Some functions I added:
getLocations(). This takes a species code and returns all the distribution data for that species merged with the HISTORICAL bioclim type summaries all as a big data frame sutiable for model fitting. But I have hacked it for now to only return the CM data since I don't trust the model fits on all the mtn ranges at once. So for now, everything is CM only. See line 84.
fitMods(): takes a set of distribution data such as that returned by getLocations() and fits each of three model types in turn and returns the models fitted as a named list
checkMods(themods, spcode): this runs through the models in the supplied list and runs some checks and prints and saves results. Plots are not working for some reason. Must check. "spode" argument just maes sure results are saved to right file names
makePrediction <- function(mod, mtn, spcode, gcm=NULL, scenario=NULL, timep=NULL) : this takes a model and predicts it over a new bioclim raster stack/brick. if gcm is null, it predicts over the historical climate which should be the same it was fit with. Otherwise it grabs the future projected climate landscape pulled from disk.
We need to check that model fitting in sdm.R is working.
I generalized the code. Some functions I added:
getLocations(). This takes a species code and returns all the distribution data for that species merged with the HISTORICAL bioclim type summaries all as a big data frame sutiable for model fitting. But I have hacked it for now to only return the CM data since I don't trust the model fits on all the mtn ranges at once. So for now, everything is CM only. See line 84.
fitMods(): takes a set of distribution data such as that returned by getLocations() and fits each of three model types in turn and returns the models fitted as a named list
checkMods(themods, spcode): this runs through the models in the supplied list and runs some checks and prints and saves results. Plots are not working for some reason. Must check. "spode" argument just maes sure results are saved to right file names
makePrediction <- function(mod, mtn, spcode, gcm=NULL, scenario=NULL, timep=NULL) : this takes a model and predicts it over a new bioclim raster stack/brick. if gcm is null, it predicts over the historical climate which should be the same it was fit with. Otherwise it grabs the future projected climate landscape pulled from disk.