sample_SVCdata | R Documentation |
Samples SVC data at given locations. The SVCs parameters and the covariance function have to be provided. The sampled model matrix can be provided or it is sampled. The SVCs are sampled according to their given parametrization and at respective observation locations. The error vector is sampled from a nugget effect. Finally, the response vector is computed. Please note that the function is not optimized for sampling large data sets.
sample_SVCdata( df.pars, nugget.sd, locs, cov.name = c("exp", "sph", "mat32", "mat52", "wend1", "wend2"), X = NULL )
df.pars |
( |
nugget.sd |
( |
locs |
( |
cov.name |
( |
X |
( |
The parameters of the model can be chosen such that we obtain data
from a not full model, i.e., not all covariates are associated with a
fixed and a random effect. Using var = 0
for instance yields a
constant beta coefficient for respective covariate. Note that in that
case the scale
value is neglected.
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. The true_pars
contains the data frame of covariance parameters that were used to
sample the GP-based SVCs. The nugget variance has been added to the
original argument of the function with its respective variance, but
NA
for "mean"
and "scale"
.
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_SVCdata( df.pars = df.pars, nugget.sd = tau, locs = s, cov.name = "mat32" )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.