simMVGPR: Simulate Data for Multivariate Gaussian Process Regression

View source: R/simMVGPR.R

simMVGPRR Documentation

Simulate Data for Multivariate Gaussian Process Regression

Description

simMVGPR generates simulated data for Multivariate Gaussian Process Regression (MVGPR) models, including the true hyperparameters used for simulation.

Usage

simMVGPR(
  N = 200,
  M = 2,
  d = 3,
  sigma2 = 0.1,
  tau = 2,
  kernel_func = kernel_se,
  perc_spars = 0.5,
  rho = 0,
  theta,
  Omega,
  device
)

Arguments

N

Positive integer specifying the number of observations to simulate. Default is 200.

M

positive integer specifying the number of response variables. Default is 2.

d

Positive integer specifying the number of covariates for the covariance structure. Default is 3.

sigma2

Positive numeric value specifying the noise variance. Default is 0.1.

tau

Positive numeric value specifying the global shrinkage parameter. Default is 2.

kernel_func

Function specifying the covariance kernel. Default is kernel_se.

perc_spars

Numeric value in [0, 1] indicating the proportion of inactive (zero) inverse length-scale parameters in theta. Default is 0.5.

rho

Numeric value in [0, 1] indicating the correlation between the covariates. Default is 0.

theta

Optional numeric vector specifying the true inverse length-scale parameters. If not provided, they are randomly generated.

Omega

Optional positive definite matrix of size M x M. If not provided, it is generated as S x D x S, where D is a correlation matrix generated by the LKJ distribution with shape parameter 1, and S is a diagonal matrix with entries sampled from a gamma(1, 1) distribution.

device

Optional torch_device object specifying whether to run the simulation on CPU or GPU. Defaults to GPU if available.

Details

This function simulates data from a multivariate Gaussian process regression model. The response variable y is sampled from a matrix normal distribution with a covariance matrix determined by the specified kernel function, theta, tau, the correlation matrix Omega and sigma2 in the following way:

\bm Y \sim \mathcal{MN}_{N,M}(\bm 0, \bm K(\bm x; \bm \theta, \tau) + \bm I \sigma^2, \bm \Omega)

which is equivalent to

vec(\bm Y) \sim \mathcal{N}_{NM}(\bm 0, \bm \Omega \otimes (\bm K(\bm x; \bm \theta, \tau) + \bm I \sigma^2))

.

Value

A list containing:

  • data: A data frame with M + d columns y.1, ..., y.M (response variables) and x.1, ..., x.d (covariates for the covariance structure).

  • true_vals: A list containing the true values used for the simulation:

    • theta: The true inverse length-scale parameters.

    • sigma2: The true noise variance.

    • tau: The true global shrinkage parameter.

Examples

if (torch::torch_is_installed()) {
  torch::torch_manual_seed(123)

  # Simulate data with default settings
  sim_data <- simMVGPR()

  # Simulate data with custom settings
  sim_data <- simMVGPR(N = 100, d = 5, perc_spars = 0.3, sigma2 = 0.5)

  # Access the simulated data
  head(sim_data$data)

  # Access the true values used for simulation
  sim_data$true_vals
  }

shrinkGPR documentation built on March 30, 2026, 5:06 p.m.