Hi,
I am trying to do regression kriging with this commands:
#Regression modeling
regSI <- lm(SI~OrgMat+Moisture+pH, data = malpie)
summary(regSI)
# add residual to malpie
malpie$resSI <- regSI$residuals
# calculate variogram of residual
gresSI <- gstat(id="resids", formula = resSI~1, data = malpie)
vgresSI <- variogram(gresSI)
plot(vgresSI,plot.nu=T)
vgmresSI <- fit.variogram(vgresSI, model=vgm(psill=400, range=150, model="Sph", 
                          add.to= vgm(psill=100, range=500, model="Sph")))
plot(vgresSI, vgmresSI, ylim=c(0,600))
vgmresSI
 
#regression kriging
malpie_rk <- krige(SI~OrgMat+Moisture+pH, locations=malpie, newdata=zgrid)  # regression part only!
malpie_rok <- krige(residuals(regSI)~1, locations=malpie, newdata=zgrid, model=vgmresSI)  # OK of residuals
 
CHALLENGE: the regression part gives me the error message: Error in eval(expr, envir, enclos) : object 'OrgMat' not found.
Can someone help me on how to solve this?

Israel Ikoyi
	[[alternative HTML version deleted]]

