I would like to krige residuals (from multiple linear regression) of yearly precipitation totals from a 50 years time series. Every year has been regressed individually. The residuals will be added to the regression prediction and thereby improve the prediction. Using automatic fitting for the residuals for every year independently (like autofitVariogram in the automap package in R) does produce some unfortunate variograms. In order to avoid fitting for every year a variogram individually, I thought about pooling the data and calculating one variogram over a bigger temporal subset, assuming the same spatial process is causing the residual pattern. Is this a way to krige my residuals?

Two questions arise doing that; probably they should rather be posted somewhere else?

  • When calculating a pooled variogram using gstat in R, there is an argument dX. I read, that it is used, to rescale time to space? Is it correct to set dX = 0 in order to take every year as a realization of the same spatial process? What is variogram doing with the zero-distances for pooled data, because I have several observations at the same data point ?

  • Using a subset over several years for one sample variogram leads to zero-distance semivariance between two points of the same station but a different year. Fit.method 7 (in the gstat manual: N/h) does not work, probably because of the zero-distance. Is there an option to still use all the points with fit.method 7?

For periods with more observations the zero-distance semivariance doesn't seem to be a problem, for periods with less observations it is. However, in both periods, there are zero-distance point pairs. What is influencing, whether fit method 7 can be applied to fit the data?

An example of my code (in R using the gstat package) with a very small subsample of the data:

res.sub = dataframe(x=c(244500, 194100, 231900, 244500), y=c(10116660, 10025460, 10073460, 10116660), resis= c(-11.634, 112.347, -25.674, 68.456),  year= c(1984,1984,1984,1985))
coordinates(res.sub) = res.sub[, c("x","y")]
crs(res.sub) = "+proj=utm +zone=37 + south +ellps=WGS84"

varpooled = variogram(resis~1, data= res.sub, cressie=TRUE, width=2000, cutoff=150000, dX=0)

fitvarpooled = fit.variogram(varpooled, vgm(8000,"Exp", 100000,1000), fit.method =7)
  • $\begingroup$ Presumably you're using R, but what package are you using? Although software-specific questions are off-topic here, your question looks like it may have some statistical aspects. In particular, it looks like you may be trying to use a purely spatial model for what is essentially a space-time problem. Could you back up and explain what your analytical objective is? Could it be the same as described in the abstract at adsabs.harvard.edu/abs/2016AdWR...87...92T ? $\endgroup$
    – whuber
    Mar 17, 2016 at 16:45

1 Answer 1



varpooled = variogram(resis~year, data= res.sub, 
   cressie=TRUE, width=2000, cutoff=150000, dX=0)

to get the pooled, within-year variogram for resis. See the dX documentation in ?variogram.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.