Learn R Programming

kergp (version 0.5.7)

coef-methods: Extract Coefficients of a Covariance Kernel Object as Vector, List or Matrix

Description

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

Usage

# S4 method for covMan
coef(object)

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

Value

A numeric vector of coefficients or a structure as specified by

as containing the coefficients selected by type.

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.

See Also

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

Examples

Run this code
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")

Run the code above in your browser using DataLab