Learn R Programming

varycoef (version 0.3.2)

sample_fullSVC: Sample Function for GP-based SVC Model for Given Locations

Description

Samples SVC data at given locations. The SVCs parameters and the covariance function have to be provided. The sampled model matrix contains an intercept as a first column and further covariates sampled from a standard normal. The SVCs are sampled according to their given parametrization and at respective observation locations. The error vector sampled from a nugget effect. Finally, the response vector is computed.

Usage

sample_fullSVC(
  df.pars,
  nugget.sd,
  locs,
  cov.name = c("exp", "sph", "mat32", "mat52", "wend1", "wend2")
)

Arguments

df.pars

(data.frame(p, 3)) Contains the mean and covariance parameters of SVCs. The three columns must have the names "mean", "var", and "scale".

nugget.sd

(numeric(1)) Standard deviation of the nugget / error term.

locs

(numeric(n) or matrix(n, d)) The numeric vector or matrix contains the observation locations and therefore defines the number of observations to be n. For a vector, we assume locations on the real line, i.e., \(d=1\).

cov.name

(character(1)) Character defining the covariance function, c.f. SVC_mle_control.

Value

list Returns a list with the response y, model matrix X, a matrix beta containing the sampled SVC at given locations, a vector eps containing the error, and a matrix locs containing the original locations.

Examples

Run this code
# NOT RUN {
set.seed(123)
# SVC parameters
(df.pars <- data.frame(
   var = c(2, 1),
   scale = c(3, 1),
   mean = c(1, 2)))
# nugget standard deviation
tau <- 0.5

# sample locations
s <- sort(runif(500, min = 0, max = 10))
SVCdata <- sample_fullSVC(
  df.pars = df.pars, nugget.sd = tau, locs = s, cov.name = "mat32"
)

# }

Run the code above in your browser using DataLab