简体   繁体   中英

predict function for MaxEnt(Software R)

I'm trying to use predict function for predict potencial occurrence points in space transfer. For this I using dismo package loaded with presence points in original space, 17 raster layers for original space and 17 raster layer for transfer space. All the rasters are identicals in extent, grid resolution and dimension, differing only in geographic coords. The original space and the transfer space are located in different continents and I have used kfold techinque for partitioning of my samples in training and testing.

I fit my maxent model with:

me<-maxent(predictor, training)

but, I can't project my fit model in the transfer space, returning:

pred<-predict(me,predictor2)
    Erro em .local(object, ...) : missing layers (or wrong names)

*predictors 1 and 2 are in raster stack file

*All the directories were correctly choosen, and the files is found into the directory.

*both, stack contain the same variable in for each geographic space

That points to 'wrong names' then. This could fix that

names(predictor2) <- names(predictor)

But do make sure that this is correct (that is, that the two RasterStack objects have the same layers in the same order), by inspecting

names(predictor2)
names(predictor)

The raster method for predict specifies that the 'newdata' raster (object) is the first argument and the model the second.

## S4 method for signature 'Raster'
predict(object, model, filename="", fun=predict, ext=NULL, 
const=NULL, index=1, na.rm=TRUE, inf.rm=FALSE, factors=NULL, 
format, datatype, overwrite=FALSE, progress='', ...)

Try:

pred<-predict(predictor2, me)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM