Learn R Programming

varycoef (version 0.3.2)

fullSVC_reggrid: Sample Function for GP-based SVC Models on Regular Grid

Description

Samples SVC data on a regular quadratic (Cartesian) grid. The SVCs have all mean 0 and an Matern covariance function is used.

Usage

fullSVC_reggrid(m, p, cov_pars, nugget, seed = 123, given.locs = NULL)

Arguments

m

(numeric(1)) Number of observations in one dimension, i.i, the square root number of total number of observation locations \(n = m^2\).

p

(numeric(1)) Number of SVCs.

cov_pars

(data.frame(p, 2)) Contains the covariance parameters of SVCs. The two columns must have the names "nu", "var" and "scale". These covariance parameters are then used for sampling the respective SVCs.

nugget

(numeric(1)) Variance of the nugget / error term.

seed

(numeric(1)) Seed set within the function for sampling.

given.locs

(NULL or data.frame(n, 2)) If NULL, the observations locations are sampled from a regular grid, Otherwise, the data.frame contains the observation locations. The data frame must have two columns of name "x" and "y". The number of observations is then the number of rows n.

Value

(data.frame(m*m, p+3) Data frame with p+3 columns: first p are SVCs followed by a nugget and two columns for coordinates, i.e., locations. Number of observations is m*m.

Examples

Run this code
# NOT RUN {
# number of SVC
p <- 3
# sqrt of total number of observations
m <- 20
# covariance parameters
(pars <- data.frame(
  nu = rep(0.5, p),
  var = c(0.1, 0.2, 0.3),
  scale = c(0.3, 0.1, 0.2)
))
nugget.var <- 0.05

# function to sample SVCs
sp.SVC <- fullSVC_reggrid(m = m, p = p,
                          cov_pars = pars,
                          nugget = nugget.var)
head(sp.SVC)

# }

Run the code above in your browser using DataLab