predict function for MaxEnt(Software R)

让人想犯罪 __ 提交于 2021-02-11 15:34:24

问题


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


回答1:


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)



回答2:


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)


来源:https://stackoverflow.com/questions/32875250/predict-function-for-maxentsoftware-r

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!