0

i was doing SDM using MaxEnt in R but i couldnt run jackknife test


# add uae shapefile`
uae = readOGR(dsn ="C:/Users/Predator/Downloads", layer="Boundaries_UAE_0_GAUL")


pj = gbif("Prosopis", "juliflora", ext=uae ,geo=T) #with geographic points only and sp as dat frame

pj=pj[,c("lon","lat")] # add lat lon

biow=raster::getData("worldclim",var="bio",res=2.5) #get world clim data

#crop the data to the uae
bio<-crop(biow,extent(uae))

#download future data for CMIP5 in 50 years
biof=raster::getData("CMIP5",var="bio",res=2.5,rcp=45,year=50,model="AC" ,download = TRUE) 

# croping biof to the area
biof<-crop(biof,extent(uae))

names(biof) = names(bio)

# Kfold to 5 groups
group=kfold(pj,5)
pres_train= pj[group!=1,]
pres_test= pj[group==1,]

#train the model
xm = maxent(bio, pres_train, jackknife=TRUE) 

using jackknife=TRUE doesnt work and trying 
enm_eval <- ENMevaluate( algorithm = "maxent", xm, bio, pres_test, bg )`

then i get

Error in as.data.frame.default(occs) : cannot coerce class ‘structure("MaxEnt", package = "dismo")’ to a data.frame

1 Answers1

0

If you are running Maxent through the dismo library you need to set -J, for jackknife, in the "args" command inside maxent(). Do as follows:

xm = maxent(bio, pres_train, args=c("-J")) 

There are also numerous other commands that should be set, e.g. "cloglog", "betamultiplier" and most importantly feature selections..

Dr. Flow
  • 456
  • 5
  • 19