Function for block kriging and regression slope?

Any question regarding the Interpolation method using Kriging

Function for block kriging and regression slope?

Postby markm0705 » Tue Aug 27, 2019 10:54 pm

I'm looking for the function to perform ordinary block kriging where I should be able to set the block discretization as a parameter. Is there also a way to get the block kriging to records the block variance, and lagrange parameters so I can calculate the theoretical slope of regression for the block estimate?
Last edited by markm0705 on Sun Sep 15, 2019 1:53 pm, edited 2 times in total.
markm0705
 
Posts: 22
Joined: Sun Mar 17, 2019 9:39 am

Re: Function for block kriging and kriging regression slope?

Postby Fabien Ors » Wed Aug 28, 2019 9:47 am

Dear,

Regarding the block kriging, the answer is in the 'kriging' function documentation.
You should use the arguments calcul="block" and ndisc=N like in the following example.
The 'kriging' function also returns for each target:
- the variance of the block estimation when flag.varz=TRUE and
- the variance of the block estimation error (aka kriging error) when flag.std=TRUE (stdev²)

Code: Select all
data = db.create(x1=runif(10),x2=runif(10),z1=rnorm(10))
grid = db.create(nx=c(10,10),dx=c(0.1,0.1))
model = model.create(vartype="Spherical",range=0.3)
neigh = neigh.create(type=2, nmaxi=3, radius=2)
grid2 = kriging(data, grid, model, neigh, calcul="block", ndisc=4, flag.varz=TRUE, flag.std=TRUE)
plot(grid2, name = "z3")


For Lagrange parameters, it's a little bit more tricky.
You should call the 'krigtest' function for each target.
You will find the Lagrange parameter in the 'zam' vector returned by this function.
Indeed, the Lagrange parameter is the first 'Drift coefficient' which corresponds to the Universality condition.

Code: Select all
lagrange = c()
for(iech in seq(1, grid$nech)) {
  res = krigtest(data, grid, model, neigh, calcul="block", ndisc=4, iech0=iech)
  lagrange = c(lagrange, res$zam[res$nech+1])
}
grid2 = db.add(grid2, lagrange, loctype="z")
plot(grid2)


Hope this helps
Best regards
Fabien Ors
Administrateur du site
 
Posts: 226
Joined: Thu Sep 20, 2012 1:07 pm

Re [PROBLEM] Function for block kriging and regression slope

Postby markm0705 » Sat Aug 31, 2019 1:23 pm

Apologies for the slow response on this. I just tested the solution to extract the lagrange multiplier and unfortunately 'krigtest' causes a R to crash for some unknown reason. I even tried a few things with the function parameters like 'res = krigtest(data, grid, model, neigh, calcul="point")' but this also causes a crash.

Also, I would like to be able to like to extract the block variance - but expect that will also be in the krigtest output once the (possible) bug is fixed
markm0705
 
Posts: 22
Joined: Sun Mar 17, 2019 9:39 am


Return to Kriging

Who is online

Users browsing this forum: No registered users and 4 guests