Skip to contents

Draws a latent Gaussian-process realization at supplied inputs and then adds independent Gaussian observation noise. The kernel, mean, noise variances, and numerical jitter used for simulation are retained in the result.

Usage

simulate_gp_data(
  x,
  kernel,
  mean = zero_mean(),
  noise_variance = 0,
  seed = NULL,
  initial_jitter = 0,
  fallback_jitter = 1e-10,
  jitter_multiplier = 10,
  max_attempts = 8L,
  symmetry_tolerance = sqrt(.Machine$double.eps)
)

Arguments

x

Numeric vector or matrix of simulation inputs.

kernel

Gaussian-process kernel specification.

mean

Gaussian-process mean specification. Its coefficients must be fixed or have a Gaussian coefficient_prior(), whose uncertainty the simulated latent function includes.

noise_variance

Non-negative scalar or one non-negative value per observation.

seed

Optional non-negative integer seed. The caller's global random state is restored after simulation.

initial_jitter

Non-negative jitter tried first, relative to the covariance scale (the mean of its diagonal).

fallback_jitter

Positive relative jitter tried after the first failed factorization.

jitter_multiplier

Multiplicative jitter escalation factor.

max_attempts

Maximum Cholesky attempts.

symmetry_tolerance

Relative tolerance for checking that the covariance matrix is symmetric.

Value

An object of class gaussianprocesses_simulation.

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

simulation <- simulate_gp_data(
  seq(0, 1, length.out = 30),
  kernel = rbf_kernel(length_scale = 0.2),
  noise_variance = 0.01,
  seed = 1
)
simulation
#> Gaussian-process simulation
#>   observations: 30
#>   input dimensions: 1
#>   noise variance range: [0.01, 0.01]
#>   simulation jitter: 1e-10

head(cbind(latent = simulation$latent, observed = simulation$observed))
#>          latent   observed
#> [1,] -0.6264538 -0.4905859
#> [2,] -0.5857827 -0.5960615
#> [3,] -0.5636296 -0.5248625
#> [4,] -0.5411984 -0.5465789
#> [5,] -0.4982231 -0.6359290
#> [6,] -0.4202023 -0.4617017