Skip to contents

coef() returns the coefficients \(\beta\) of a model's mean function, and vcov() their covariance given the hyperparameters.

Usage

# S3 method for class 'gaussianprocesses_latent_model'
coef(object, ...)

# S3 method for class 'gaussianprocesses_model'
coef(object, ...)

# S3 method for class 'gaussianprocesses_model'
vcov(object, ...)

Arguments

object

A fitted gaussianprocesses_model or, for coef(), gaussianprocesses_latent_model.

...

Unused.

Value

coef(): a named numeric vector. vcov(): a matrix with matching row and column names.

Details

For estimated coefficients, coef() is the generalized least-squares estimate \(\hat\beta\) and vcov() its covariance \((H^\top C^{-1} H)^{-1}\). For marginalized coefficients they are the posterior mean \(\bar\beta\) and covariance \((B^{-1} + H^\top C^{-1} H)^{-1}\). Fixed coefficients have zero covariance. Both treat the kernel and noise parameters as known. The zero mean has no coefficients.

For latent models (fit_latent_gp()), coef() returns the fixed coefficients, the estimate that maximizes the approximate marginal likelihood, or, under a Gaussian prior \(N(b, B)\), the approximate posterior mean \(b + B H^\top a\) with \(a = \nabla \log p(y \mid \hat f)\). They have no vcov() method.

Stability

Stable: from version 1.0.0 this interface changes incompatibly only in a major release, after a deprecation period. Results and options that concern an experimental model class, kernel, or argument follow that interface's tier. See gaussianprocesses-package for the policy.

Examples

x <- seq(0, 4, length.out = 25)
model <- fit_gp(x, 1 + 0.5 * x + sin(2 * x), rbf_kernel(length_scale = 0.5),
  noise_variance = 0.01, mean = linear_mean())

coef(model)
#> intercept        x1 
#> 0.9194838 0.6207013 
vcov(model)
#>            intercept         x1
#> intercept  0.6523125 -0.2069378
#> x1        -0.2069378  0.1034689