如何使用“ lrm”模型(rms软件包)对栅格堆栈进行空间预测?

时间:2019-06-10 15:14:56

标签: r logistic-regression raster prediction

我已经使用“ rms”包的“ lrm”函数拟合了逻辑回归模型,并且需要对一堆栅格(每个预测变量一个)进行空间预测。

我尝试使用“光栅”包的“预测”功能,但是,尽管它似乎可行,但其预测是错误的。

# First of all I fitted a lrm model with 7 predictors, each predictors was
# introduced in the model as a spline of 3 nodes (rcs(---, 3)):

model3<-lrm(pres~rcs(aspect,3)+rcs(fcc,3)+rcs(hli,3)+rcs(mde,3)
     +rcs(river,3)+ rcs(slope,3)+rcs(clim3,3),data=cal1,x=T,y=T)

# Secondly I made a stack of rasters, one for each of the predictors

RastDat<-stack(aspect,fcc,hli,mde,river,slope,clim3)

# And finally I tried to make predictions for RastDat with 'predict'
# function of 'raster' package

AcePred<-predict(RastDat, model3, type="fitted.ind")

该函数生成一个栅格,但是当直接使用'rms'包的'predict'函数时,该栅格的值与模型为每个像素获得的预测不匹配。

0 个答案:

没有答案
相关问题