Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why UK is calculating Variogram on the sampled data rather than on the detrended sample residuals? #167

Closed
ehxan139 opened this issue Oct 13, 2020 · 2 comments
Assignees
Labels

Comments

@ehxan139
Copy link

ehxan139 commented Oct 13, 2020

Hi

First of all thankyou for doing a wonderful job with the PyKrige package. It's very well written and documented.

I have a small query regarding the UK algorithm in the package (uk.py) and was wondering if you can help me out. In your implementation of the UK, you have used variograms calculated from the sample data (e.g. in function _get_kriging_matrix()). However, in the references that you have mentioned and elsewhere, UK is implemented with variograms calculated from the residuals of detrended samples.

I am sure there must be a reason for your implementation, but I am unable to find a reference that mentions to use variogram of original samples even after the trend is modeled. I was hoping if you could guide me to the reference that why do we use variograms of original samples and not the residuals ?

@MuellerSeb
Copy link
Member

That is a good question. Let's try to answer:

In literature, the term detrending is handled very differently in terms of kriging. We have several algorithms that deal with this:

  • Universal Kriging (UK): an internal/functional drift is given and represented in the kriging matrix. The drift terms can be evaluated functional from input and output points by the given drift-functions (e.g. regional linear...). The term drift is the better one here, since the data is not detrended but is assumed to have a linear correlation to the given drift.
  • External drift Kriging (EDK): the drift at the input/conditioning data as well as at the output points is given by an external source (for example a digital elevation model DEM) and again a linear correlation of the target variable to this drift is assumed
  • Regression Kriging (RK): Here we actually deal with residuals. A trend model is fitted to the data and afterwards, we apply ordinary kriging (OK) to the residuals.

So to answer your question: within UK, there is no trend fitted to the data, only an additional drift is given as described above. Therefore, the variogram is estimated to the not-detrended input data, since it can't be detrended beforehand AND the variogram properties also acutally belong to this not-detrended data.

If you want to use a kriging routine, that estimates the variogram properties from the residuals after applying a trend-model, you have to use Regression Kriging (RK).

Also have a look here: https://en.wikipedia.org/wiki/Regression-kriging

There a separate section deals with these differences.

Cheers, Sebastian

@MuellerSeb MuellerSeb self-assigned this Oct 14, 2020
@ehxan139
Copy link
Author

Hmmm... this makes sense now. I missed the part that the drift function is actually included in the kriging matrix. I will look into regression kriging as well to see if it fits my problem better. Thank you for such an awesome job and contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants