Learn R Programming

varycoef (version 0.3.2)

fullSVC_line: Sample Function for GP-based SVC Model on Real Line

Description

Samples SVC data on a real line. The SVCs parameters and the sample locations have to be provided. The SVCs are assumed to have an Matern covariance function. 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

fullSVC_line(df.pars, nugget.sd, locs)

Arguments

df.pars

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

nugget.sd

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

locs

(numeric(n)) The vector contains the observation locations and therefore defines the number of observations to be n.

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 vector locs containing the original locations.

Examples

Run this code
# NOT RUN {
set.seed(123)
# SVC parameters
(df.pars <- data.frame(
   nu = c(1.5, 1.5),
   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 <- fullSVC_line(
  df.pars = df.pars,
  nugget.sd = tau,
  locs = s
)

# }

Run the code above in your browser using DataLab