ok: Class of Ordinary Kriging

Description Usage Arguments Details Value Author(s) Examples

View source: R/ok.R

Description

An implementation of Ordinary Kriging based upon a km-class object that should be faster than usual predict method.

Usage

1
ok(model, beta = NULL)

Arguments

model

a kriging model object from DiceKriging::km-class

beta

the trend of the model

Details

The Ordinary Kriging is a special case of kriging where the trend is supposed to be and unknown constant. Consequently some linear algebra operations can be reduced by knowning that the vector of parameter beta is indeed a real.

The ok class defines three functions: xi the kriging predictor, updateSd and updateSdfast two methods for updating the kriging variance when some poitns are virtually added to the model. These two last functions differ in their implementation: the first one allows for the user to specify which are the predicted points and which are the added points. The second one outputs a matrix where the kriging variances of all the points is updated when each one is iteratively added the the Design of Experiments.

The faster between looping updateSd and using updateSdfast is indeed problem dependent (depending on parallel computer, size of the data, etc.) and should be benchmark by the user.

Value

An object of S3 class 'ok' containing

Kinv

the inverse of the covariance matrix of the data

beta

the estimated coefficient of the trend

y_centred

the data centred according to the estimated trend

sigma_beta

the standard deviation of the estimation of beta

xi

the kriging predictor

updateSd

a function to calculate the updated kriging variance when Xnew points are added to the Design of Experiments

updateSdfast

a function to calculate the update kriging variance when the SUR criterion is minimised over a population which is also the one used to estimate it.

Author(s)

Clement WALTER clementwalter@icloud.com

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
# Generate a dataset
X <- data.frame(x1 = rnorm(10), x2 = rnorm(10))
y <- cos(sqrt(rowSums(X^2)))

# Learn a model
krig <- DiceKriging::km(design=X, response=y)

# Create Ordinary Kriging object
OK <- ok(krig)

# Microbenchmark
# create a dataset
X = data.frame(x1 = rnorm(100), x2 = rnorm(100))
microbenchmark::microbenchmark(OK$xi(t(X)), predict(krig, X, type="UK"))

# Check identical results
X <- rnorm(2)
OK$xi(X)[c('mean', 'sd')]
predict(krig, data.frame(x1=X[1], x2=X[2]), type="UK")[c('mean', 'sd')]

clemlaflemme/mistral documentation built on Jan. 3, 2020, 9:13 a.m.