kmModel: 'kmModel'

Description Usage Format Value References See Also Examples

Description

An object of class StatModel that provides infra-structure for an unfitted Kriging model.

Usage

1

Format

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
Formal class 'StatModel' [package "modeltools"] with 5 slots
  ..@ name        : chr "kriging model"
  ..@ dpp         :function (formula, data = list(), subset = NULL, na.action = NULL, frame = NULL, 
    enclos = sys.frame(sys.nframe()), other = list(), designMatrix = TRUE, 
    responseMatrix = TRUE, setHook = NULL, ...)  
  ..@ fit         :function (object, weights = NULL, noise.var = NULL, km.args = NULL, ...)  
  ..@ predict     :function (object, newdata = NULL, ...)  
  ..@ capabilities:Formal class 'StatModelCapabilities' [package "modeltools"] with 2 slots
  .. .. ..@ weights: logi FALSE
  .. .. ..@ subset : logi FALSE

Value

Slot fit returns an object of class kmModel.

References

Roustant, O., Ginsbourger, D. and Deville, Y. (2012), DiceKriging, DiceOptim: Two R packages for the analysis of computer experiments by Kriging-based metamodeling and optimization. Journal of Statistical Software, 51(1), http://www.jstatsoft.org/.

See Also

StatModel, km, Predict.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
## We use the first example in the documentation of function km
if (require(DiceKriging)) {
    d <- 2L
    x <- seq(0, 1, length = 4L)
    design <- expand.grid(x1 = x, x2 = x)
    y <- apply(design, 1, branin)
    df <- data.frame(y = y, design)

    ## Fitting the model using kmModel:
    # data pre-processing
    mf <- dpp(kmModel, y ~ ., data = df)
    # no trend (formula = ~ 1)
    m1 <- fit(kmModel, mf)
    # linear trend (formula = ~ x1 + x2)
    m1 <- fit(kmModel, mf, formula = ~ .)
    # predictions on the training data
    # recommended: improved version of predict for models fitted with objects
    # of class StatModel
    Predict(m1, type = "UK")
    # also possible
    predict(m1, type = "UK")

    ## This is equivalent to:
    # no trend (formula = ~ 1)
    m2 <- km(design = design, response = y)
    # linear trend (formula = ~ x1 + x2)
    m2 <- km(formula = ~ ., design = design, response = y)
    # predictions on the training data
    predict(m2, newdata = design, type = "UK")

    ## extract information
    coef(m1)
    residuals(m1)
    logLik(m1)

    ## diagnostic plots
    plot(m1)
}

schiffner/mobKriging documentation built on May 29, 2019, 3:39 p.m.