我正在做物種分佈建模(生態位模型),我將模型投影到當前或未來的氣候柵格(Bioclim變量)。問題與預測函數在R爲一個biostack而不是另一個
當我預測,以目前的柵格(對象= bio_stack),一切正常,使用此代碼:
#predict species current distribution using bio_stack
current_dist<-predict(object=bio_stack, model=mod_gam,filename="whitebark_current_dist_17April2014",
na.rm=TRUE, type="response", format="GTiff", overwrite=TRUE,
progress="text")
然而,當我預測未來柵格(object=future_bio_stack
),該代碼不會產生結果:
#predict species future distribution using future_bio_stack
future_dist<-predict(object = future_bio_stack, model=mod_gam,filename="whitebark_future_dist_17April2014",
fun=predict, na.rm=TRUE, type="response", format="GTiff", overwrite=TRUE,
progress="text")
相反,我得到這樣的警告消息:
In addition: Warning message:
In predict.gam(model, blockvals, ...) :
not all required variables have been supplied in newdata!
我正在投影的未來biostack圖層在圖像中可以正常顯示,具有正常的最小值和最大值(我不能在沒有信譽評分的情況下發布圖像)。
但是,future_bio_stack的最小值和最大值在摘要中看起來很奇怪,特別是與bio_stack相比。下面是每個堆棧的總結,與最小值和最大值設置:
> future_bio_stack
class : RasterStack
dimensions : 4800, 5880, 28224000, 5 (nrow, ncol, ncell, nlayers)
resolution : 0.008333333, 0.008333333 (x, y)
extent : -152, -103, 30, 70 (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +ellps=WGS84 +no_defs
names : WC05future_clipped, WC06future_clipped, WC08future_clipped, WC13future_clipped, WC15future_clipped
min values : -32768, -32768, -32768, -32768, -32768
max values : 32767, 32767, 32767, 32767, 32767
> bio_stack
class : RasterStack
dimensions : 4800, 5880, 28224000, 5 (nrow, ncol, ncell, nlayers)
resolution : 0.008333333, 0.008333333 (x, y)
extent : -152, -103, 30, 70 (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0
names : WC05_clipped, WC06_clipped, WC08_clipped, WC13_clipped, WC15_clipped
min values : -56, -429, -145, 7, 5
max values : 457, 100, 332, 767, 129
任何想法,爲什麼bio_stack
正在與predict
功能,但future_bio_stack
是不是?