spv {vdg} | R Documentation |
Calculate the Scaled Prediction Variance (or SPV)
Description
Calculates the SPV for a sample of points in a design region of specified type. Sampling is done
by calling sampler
.
Usage
spv(
n,
design,
type = "spherical",
formula,
at = FALSE,
keepfun,
sample,
unscaled = FALSE,
...
)
## S3 method for class 'data.frame'
spv(
n,
design,
type = c("spherical", "cuboidal", "lhs", "mlhs", "slhs", "rslhs", "custom"),
formula,
at = FALSE,
keepfun,
sample,
unscaled = FALSE,
...
)
## S3 method for class 'list'
spv(
n,
design,
type = c("spherical", "cuboidal", "lhs", "mlhs", "slhs", "rslhs", "custom"),
formula,
at = FALSE,
keepfun,
sample,
unscaled = FALSE,
...
)
## S3 method for class 'matrix'
spv(
n,
design,
type = c("spherical", "cuboidal", "lhs", "mlhs", "slhs", "rslhs", "custom"),
formula,
at = FALSE,
keepfun,
sample,
unscaled = FALSE,
...
)
Arguments
n |
number of samples to take |
design |
a design or list of designs. Each design must be either a matrix or a data.frame or coercible to a data.frame. |
type |
type of sampling passed to |
formula |
either a single model formula of a list of formulae |
at |
only used when type is |
keepfun |
optional; function operating on the columns of a matrix with the same number of columns as design which return a logical value for including a specific point in the sample or not. Useful for rejection sampling for nonstandard design regions. |
sample |
optional; if not missing it should contain a matrix or data.frame containing points sampled over the required design region. If it is not missing, no further sampling will be done: the SPV is simply evaluated at these points. |
unscaled |
logical indicating whether to use the unscaled prediction variance (UPV) instead of the scale prediction variance (SPV) |
... |
additional arguments passed to |
Value
Object of class 'spv', 'spvlist', 'spvforlist' or 'spvlistforlist', depending on whether single designs/formulas are passed or lists of these.
Author(s)
Pieter C. Schoonees
References
Pieter C. Schoonees, Niel J. le Roux, Roelof L.J. Coetzer (2016). Flexible Graphical Assessment of Experimental Designs in R: The vdg Package. Journal of Statistical Software, 74(3), 1-22. doi:10.18637/jss.v074.i03.
See Also
plot.spv
for more examples
Examples
# Single design (class 'spv')
library(rsm)
bbd3 <- as.data.frame(bbd(3)[,3:5])
colnames(bbd3) <- paste0("x", 1:3)
quad.3f <- formula(~(x1 + x2 + x3)^2 - x1:x2:x3)
out <- spv(n = 1000, design = bbd3, type = "spherical", formula = quad.3f)
out