plot.spv: Plot VDGs or FDS plots

plot.spvR Documentation

Plot VDGs or FDS plots

Description

Produce Variance Dispersion Graphs and/or Fraction of Design Space plots for experimental designs. There are methods for the S3 classes spv, spvlist, spvforlist and spvlistforlist – see spv.

Usage

## S3 method for class 'spv'
plot(
  x,
  which = c("fds", "vdgsim", "vdgquantile", "vdgboth", "boxplots"),
  np = 50,
  alpha = 7/sqrt(length(x$spv)),
  points.colour = "#39BEB1",
  points.size = 2,
  tau = c(0.05, 0.95),
  radii = 21,
  hexbin = FALSE,
  bins = 80,
  df = 10,
  lines.size = 1,
  origin = rep(0, ncol(x$sample)),
  method,
  arrange = FALSE,
  ...
)

## S3 method for class 'spvforlist'
plot(
  x,
  which = c("fds", "vdgsim", "vdgquantile", "vdgboth", "boxplots"),
  np = 50,
  alpha = 7/sqrt(length(x[[1]]$spv)),
  points.colour = "#39BEB1",
  points.size = 2,
  tau = c(0.05, 0.95),
  radii = 21,
  hexbin = FALSE,
  bins = 80,
  df = 10,
  lines.size = 1,
  origin = rep(0, ncol(x[[1]]$sample)),
  method,
  arrange = FALSE,
  ...
)

## S3 method for class 'spvlist'
plot(
  x,
  which = c("fds", "vdgsim", "vdgquantile", "vdgboth", "boxplots"),
  np = 50,
  alpha = 7/sqrt(length(x[[1]]$spv)),
  points.colour = "#39BEB1",
  points.size = 2,
  tau = c(0.05, 0.95),
  radii = 21,
  hexbin = FALSE,
  bins = 80,
  VRFDS = FALSE,
  df = 10,
  lines.size = 1,
  origin = rep(0, ncol(x[[1]]$sample)),
  method,
  arrange = FALSE,
  ...
)

## S3 method for class 'spvlistforlist'
plot(
  x,
  which = c("fds", "vdgsim", "vdgquantile", "vdgboth", "boxplots"),
  np = 50,
  alpha = 7/sqrt(length(x[[1]][[1]]$spv)),
  points.colour = "#39BEB1",
  points.size = 2,
  tau = c(0.05, 0.95),
  radii = 21,
  hexbin = FALSE,
  bins = 80,
  df = 10,
  lines.size = 1,
  origin = rep(0, ncol(x[[1]][[1]]$sample)),
  method,
  arrange = FALSE,
  ...
)

Arguments

x

an object of type spv for a single experimental design or an object of type spvlist for multiple designs.

which

either a numeric vector of integers or a character vector indicating which plots to produce. The possible plots are:

1 or "fds"

A (variance ratio) FDS plot

2 or "vdgsim"

A VDG with only the simulated prediction variance points plotted

3 or "vdgquantile"

A VDG with only the quantile regression lines corresponding to tau shown

4 or "vdgboth"

A combination of 2 and 3

5 or "boxplots"

Parallel boxplots of the prediction variance

np

scalar; the number of points to use for calculating the fraction of design space criterion.

alpha

the alpha transparency coefficient for the plots

points.colour

colour for points in scatterplot of SPV against the radius

points.size

size for points in scatterplot of SPV against the radius

tau

the tau parameter for rq (quantile regression)

radii

either a numeric vector containing the radii to use for calculating the mean spherical SPV over the spherical design space, or an integer (length one vector) giving the number of radii to use for calculationg the mean spherical SPV. If missing, the mean spherical SPV is not used.

hexbin

logical indicating whether hexagonal binning should be used to display density instead of colour transparency

bins

argument passed to stat_binhex to determine the number of hexagons used for binning.

df

degrees-of-freedom parameter passed to bs

lines.size

line size passed to geom_line

origin

numeric vector specifying the origin of the design space

method

optional; passed to dist to overwrite defaults of "Euclidean" for spherical regions or "supremum" for cubiodal regions

arrange

Logical indicating whether to return a single graphical object arranging the resulting plots in a single plot window via grid.arrange, or whether to return the list of graphical objects containing the plots.

...

additional arguments passed to dist

VRFDS

logical indicating whether to construct a variance ratio FDS plot or not (only for class spvlist). The first design is used as reference design in case of VRFDS is TRUE

Value

Returns a list of ggplot graphical objects (or grobs) with names corresponding to the character version of which. These plot objects can be manipulated by changing plot aesthetics and theme elements.

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.

Examples


# Single design (class 'spv')
# Larger n should be used in actual cases
library(rsm)
bbd3 <- as.data.frame(bbd(3)[,3:5])
colnames(bbd3) <- paste0("x", 1:3)
quad.3f <- formula(~ x1*x2*x3 - x1:x2:x3 + I(x1^2) + I(x2^2) + I(x3^2))
set.seed(1234)
out <- spv(n = 1000, design = bbd3, type = "spherical", formula = quad.3f)
out
plot(out)

# List of designs (class 'spvlist')
## Not run: 
data(SCDH5); data(SCDDL5)
des.list <- list(SCDH5 = SCDH5, SCDDL5 = SCDDL5)
quad.5f <- formula(~ x1 + x2 + x3 + x4 + x5 + x1:x2 + x1:x3 + x1:x4 + x1:x5
                    + x2:x3 + x2:x4 + x2:x5 + x3:x4 + x3:x5 + x4:x5 
                   + I(x1^2) + I(x2^2) + I(x3^2) + I(x4^2) + I(x5^2))
out2 <- spv(n = 500, design = des.list, type = "spherical", formula = quad.5f)
out2
plot(out2)

## End(Not run)

# List of formulae (class 'spvforlist')
## Not run: 
fact3 <- expand.grid(x1 = c(-1,1), x2 = c(-1, 1), x3 = c(-1,1))
lin.3f <- formula(~ x1 + x2 + x3)
int.3f <- formula(~ (x1+x2+x3)^2)
set.seed(4312)
out3 <- spv(n = 500, design = fact3, type = "cuboidal", 
             formula = list(linear = lin.3f, interaction = int.3f))
out3
plot(out3)

## End(Not run)

# List of formulae and designs (class 'spvlistforlist')
## Not run: 
fact3.n <- rbind(fact3, 0, 0, 0)
set.seed(4312)
out4 <- spv(n = 200, design = list(factorial = fact3, factorial.with.cntr = fact3.n), 
             type = "cuboidal", formula = list(linear = lin.3f, interaction = int.3f))
out4
plot(out4)

## End(Not run)

vdg documentation built on July 8, 2022, 1:08 a.m.