Free Access Week - Data Engineering + BI
Data Engineering and BI courses are free this week!
Free Access Week - Jun 2-8

varycoef (version 0.3.0)

fullSVC_reggrid: Sample Function for SVCs

Description

Samples SVCs on a regular quadratic (Cartesian) grid. The SVCs have all mean 0 and an exponential 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=m2.

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 "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

SpatialPointsDataFrame (see SpatialPointsDataFrame-class) of the sampled SVC including the nugget.

Examples

Run this code
# NOT RUN {
# number of SVC
p <- 3
# sqrt of total number of observations
m <- 20
# covariance parameters
(pars <- data.frame(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)

library(sp)
# visualization of sampled SVC
spplot(sp.SVC, colorkey = TRUE)

# }

Run the code above in your browser using DataLab