coef-methods: Extract Coefficients of a Covariance Kernel Object as Vector,...

Description Usage Arguments Value See Also Examples

Description

Extract some of or all the coefficients of a covariance kernel object as vector, list or matrix.

Usage

1
2
3
4
5
## S4 method for signature 'covMan'
coef(object)

## S4 method for signature 'covTS'
coef(object, type = "all", as = "vector")

Arguments

object

An object representing a covariance kernel, the coefficient of which will be extracted.

type

Character string or vector specifying which type(s) of coefficients in the structure will be extracted. Can be "all" (all coefficients are extracted) or any parameter name(s) of the corresponding kernel.

as

Character string specifying the output structure to be used. The default is "vector", leading to a numeric vector. Using "list" one gets a list of numeric vectors, one by kernel parameter. Finally, using "matrix" one gets a matrix with one row by input (or dimension) and one column by (selected) kernel parameter.

Value

A numeric vector of coefficients or a structure as specified by as containing the coefficients selected by type.

See Also

The coef<- replacement method which takes a vector of replacement values.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
d <- 3
myCov1 <- covTS(d = d, kernel = "k1Exp", dep = c(range = "input"),
                value = c(range = 1.1))
myCov1
## versatile 'coef' method
coef(myCov1)
coef(myCov1, as = "matrix")
coef(myCov1, as = "list")
coef(myCov1, as = "matrix", type = "range")
coef(myCov1) <- c(0.2, 0.3, 0.4, 4, 16, 25)
coef(myCov1, as = "matrix")

Example output

Loading required package: Rcpp
Loading required package: testthat
Loading required package: nloptr
Tensor sum covariance kernel
o Dimension 'd' (nb of inputs): 3
o Kernel (1D): "exponential" with parameters: "range"
o One parameter by input:
    range: YES
o Number of parameters: 6
o Param. values: 
       x1  x2  x3
range 1.1 1.1 1.1
var   1.0 1.0 1.0
range.x1 range.x2 range.x3   var.x1   var.x2   var.x3 
     1.1      1.1      1.1      1.0      1.0      1.0 
   range var
x1   1.1   1
x2   1.1   1
x3   1.1   1
$range
 x1  x2  x3 
1.1 1.1 1.1 

$var
x1 x2 x3 
 1  1  1 

   range
x1   1.1
x2   1.1
x3   1.1
   range var
x1   0.2   4
x2   0.3  16
x3   0.4  25

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