covComp: Creator for the Class '"covComp"' for Composite Covariance...

Description Usage Arguments Details Value Caution Examples

View source: R/covComp.R

Description

Creator for the class "covComp" for Composite Covariance kernels.

Usage

1
2
covComp(formula, where = .GlobalEnv, topParLower = NULL,
  topParUpper = NULL, trace = 0, ...)

Arguments

formula

A formula. See Examples.

where

An environment where the covariance kernels objects and top parameters will be looked for.

topParLower

A numeric vector of lower bounds for the "top" parameters.

topParUpper

A numeric vector of upper bounds for the "top" parameters.

trace

Integer level of verbosity.

...

Not used yet. For passing other slot values.

Details

A covariance object is built using formula which involves kernel objects inheriting from the class "covAll" and possibly of other scalar numeric parameters called top parameters. The formula can be thought of as involving the covariance matrices rather than the kernel objects, each kernel object say obj being replaced by covMat(obj, X) for some design matrix or data frame X. Indeed, the sum or the product of two kernel objects lead to a covariance which is simply the sum or product of the kernel covariances. The top parameters are considered as parameters of the covariance structure, as well as the parameters of the covariance objects used in the formula. Their value at the creation time will be used and thus will serve as initial value in estimation.

Value

An object with S4 class "covComp".

Caution

The class definition and its creator are to regarded as a DRAFT, many changes being necessary until a stable implementation will be reached. The functions relating to this class are not for final users of GP models, but rather to those interested in the conception and specification in view of a future release of the kergp package.

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
## =========================================================================
## build some kernels (with their inputNames) in the global environment
## =========================================================================

myCovExp3 <- kMatern(d = 3, nu = "1/2")
inputNames(myCovExp3) <- c("x", "y", "z")

myCovGauss2 <- kGauss(d = 2)
inputNames(myCovGauss2) <- c("temp1", "temp2")

k <- kMatern(d = 1)
inputNames(k) <- "x"

ell <- kMatern(d = 1)
inputNames(ell) <- "y"

tau2 <- 100
sigma2 <- 4

myCovComp <- covComp(formula = ~ tau2 * myCovGauss2() * myCovExp3() + sigma2 * k())

myCovComp1 <- covComp(formula = ~ myCovGauss2() * myCovExp3() + k())

inputNames(myCovComp)
coef(myCovComp)

n <- 5
set.seed(1234)
X <- data.frame(x = runif(n), y = runif(n), z = runif(n),
                temp1 = runif(n), temp2 = runif(n))

C <- covMat(myCovComp, X = X)

Cg <- covMat(myCovComp, X = X, compGrad = TRUE)

## Simulation: purely formal example, not meaningful.

Y <- simulate(myCovComp, X = X, nsim = 100)

kergp documentation built on March 18, 2021, 5:06 p.m.