Open joshbanta opened 1 week ago
@joshbanta ENMeval is not meant to be used with single predictors, which is why I did not include this functionality. Not sure what your goal is, but you should be using multiple predictors for your Maxent models and rely on regularization to remove variables if they have low explanatory power. Don't you have other predictor variables that are hypothesized to be important to predict the niche of your species?
If you want to build a simple model, you should use GLM, or if you want to build single-predictor Maxent models for some reason, you can just run the Maxent function by itself. ENMeval is most useful when the models considerably differ from each other, which typically happens when multiple predictors are included.
Perhaps if you explain what you want to do I can help better.
@jamiemkass: That makes sense about the regularization multiplier. But wouldn't I still want to run Maxent, even when I only have a single predictor, so that I can easily get AUC, gain, and other model metrics, and all of the rich output that Maxent.jar provides? And wouldn't I still want to use ENMevaluate() to run Maxent to find the optimal set of allowed feature classes? It strikes me that Maxent will make a more nuanced model than GLM, unless you build the GLM in a Maxent-like way, by fitting coefficients for binary transformations (threshold features), piecewise linear transformations (hinge features), etc.
Please see my code below. When envs is a RasterStack with 2 or more raster layers (when I use envs2 or envs3), ENMEvaluate runs. But when I use a single raster layer (when I use envs4 or envs5), it fails to run.
occs <- read.csv(file.path(system.file(package="dismo"), "/ex/bradypus.csv"))[,2:3] envs <- raster::stack(list.files(path=paste(system.file(package="dismo"), "/ex", sep=""), pattern="grd", full.names=TRUE))
bg <- as.data.frame(dismo::randomPoints(envs, 1000)); colnames(bg) <- colnames(occs)
drop biome
envs2 <- dropLayer(envs,8)
os <- list(abs.auc.diff = FALSE, pred.type = "cloglog", validation.bg = "partition")
ps <- list(orientation = "lat_lat")
run maxent.jar
e.maxent <- ENMevaluate(occs, envs2, bg, tune.args = list(fc = c("L","LQ","LQH","H"), rm = 1:5), partitions = "block", other.settings = os, partition.settings = ps, algorithm = "maxent.jar", overlap = TRUE)
make the stack 2 raster layers
envs3 <- stack(envs[[1]], envs[[2]])
run maxent.jar
e.maxent <- ENMevaluate(occs, envs3, bg, tune.args = list(fc = c("L","LQ","LQH","H"), rm = 1:5), partitions = "block", other.settings = os, partition.settings = ps, algorithm = "maxent.jar", overlap = TRUE)
make the stack 1 raster layer
envs4 <- stack(envs[[1]])
run maxent.jar
e.maxent <- ENMevaluate(occs, list(envs4), bg, tune.args = list(fc = c("L","LQ","LQH","H"), rm = 1:5), partitions = "block", other.settings = os, partition.settings = ps, algorithm = "maxent.jar", overlap = TRUE)
make the first layer of the stack into a separate RasterLayer (no stack)
envs5 <- envs[[1]]
run maxent.jar
e.maxent <- ENMevaluate(occs, envs5, bg, tune.args = list(fc = c("L","LQ","LQH","H"), rm = 1:5), partitions = "block", other.settings = os, partition.settings = ps, algorithm = "maxent.jar", overlap = TRUE)