trend | R Documentation |
km
ObjectEvaluate the trend component of a km
object on the
given design X
.
trend(object, X, deriv = 0, diagOnly = FALSE)
object |
A |
X |
A "design": a numeric matrix or data frame wih numeric
columns compatible with |
deriv |
Logical. If |
diagOnly |
Logical. If |
The derivatives are stored in a "Jacobian array" say
J. Let n be the number of rows in X
,
If diagOnly
is FALSE
; The array is
four-dimensional with dimension (n * p) * (n * d) where the first parenthese encloses the
dimension of the "trend" matrix F and the
second one encloses the dimension of the "design" matrix
X. The general element is
J[i, j, k, l] = dF[i, j] / dX[k, l].
Note that this value is zero when i != k.
If diagOnly
is TRUE
, the Jacobian array is
3-dimensional with dimension n * p *
d and its element is
J[i, j, l] = dF[i, j] / dX[i, l].
So the structural zeroes of the previous array are omitted. This is especially useful if n is large.
The trend matrix, possibly with the Jacobian array
attached as an attribute named "deriv"
.
library(DiceKriging) # a 16-points factorial design, and the corresponding response d <- 2; n <- 16 design.fact <- expand.grid(x1 = seq(0, 1, length = 4), x2 = seq(0, 1, length = 4)) y <- apply(design.fact, 1, branin) ## kriging model 1 : matern5_2 covariance structure, no trend, no ## nugget effect fit <- km(~ x1 + x2, design = design.fact, response = y) X <- matrix(runif(n = 40), ncol = 2, dimnames = list(NULL, c("x1", "x2"))) fitTrend <- trend(fit, X = X, deriv = 1) fitTrend <- trend(fit, X = X[1, ], deriv = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.