Description Usage Arguments Details Value Note Author(s) See Also Examples
Visualizes selected aspects of an experimental design
1 2 3 4 5 |
Fx |
the |
w |
the vector of non-negative real numbers of length |
X |
an |
w.pool |
a vector with components from the set |
w.color |
the color string for plotting the design weight (from the standard list of R colors) |
w.size |
the size of the characters/balls that represent the non-zero design weights |
w.pch |
the numerical code of the characters used to plot the non-zero design weights |
w.cex |
the size of the text labels representing the magnitudes of the design weights |
w.lim |
a threshold fraction of the total design weight to plot the labels |
crit |
the optimality criterion. Possible values are |
h |
a non-zero vector of length |
dd.pool |
a vector with components from the set |
dd.color |
the color string for plotting the directional derivatives (from the standard list of R colors) |
dd.size |
the size of the characters that represent the directional derivatives |
dd.pch |
the numerical code of the character used to plot the directional derivatives |
asp |
the aspect ration of the axes |
main.lab |
the main title of the plot |
y.lab |
the label of the y axis |
return.pools |
Return the pooled values? |
echo |
Print the call of the function? |
This function performs a simple visualization of some aspects of an experimental design. It visualizes (the selected pools of) the design weights and (the selected pools of) the directional derivative. The type of graph depends on the number of columns in X
.
If return.pool
is set to TRUE
, the procedure returns the data used to plot the figure. The data can be used to plot a different figure according to the user's needs.
The labels of the axes correspond to the column names of X
. For a large unique(Fx)
, rendering the plot can take a considerable time. Note also that using RStudio, it may be a good idea to open an external graphical window (using the command windows()
) before running od_plot
.
Radoslav Harman, Lenka Filova
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | # Compute a D-optimal approximate design
# for the 2nd degree Fourier regression on a partial circle
# Use several types of graphs to visualize the design
Fx <- Fx_cube(~I(cos(x1)) + I(sin(x1)) + I(cos(2*x1)) + I(sin(2*x1)),
lower = -2*pi/3, upper = 2*pi/3, n.levels = 121)
w <- od_REX(Fx)$w.best
par(mfrow = c(2, 2))
od_plot(Fx, w, X = seq(-2*pi/3, 2*pi/3, length = 121), main = "Plot 1")
od_plot(Fx, w, X = Fx[, 2:3], asp = 1, main = "Plot 2")
od_plot(Fx, w, X = Fx[, c(2,5)], asp = 1, main = "Plot 3")
od_plot(Fx, w, X = Fx[, c(3,4)], asp = 1, main = "Plot 4")
par(mfrow = c(1, 1))
## Not run:
# Compute an I-efficient exact design of size 20 without replications
# for the Scheffe mixture model
# Use several types of graphs to visualize the design
Fx <- Fx_simplex(~x1 + x2 + x3 + I(x1*x2) + I(x1*x3) + I(x2*x3) - 1, 21)
w <- od_AQUA(Fx, b3=20, bin=TRUE, crit="I")$w.best
X <- Fx[, 1:2]
colnames(X) <- c("", "")
od_plot(Fx, w, X, asp = 1, main = "Plot 1")
od_plot(Fx, w, Fx[, 1:3], main = "Plot 2")
# Compute a symmetrized D-optimal approximate design
# for the full quadratic model with 4 factors
# Use several types of graphs to visualize the design
form.q <- ~x1 + x2 + x3 + x4 + I(x1^2) + I(x2^2) + I(x3^2) + I(x4^2) +
I(x1*x2) + I(x1*x3) + I(x1*x4) + I(x2*x3) + I(x2*x4) + I(x3*x4)
Fx <- Fx_cube(form.q, n.levels = rep(11, 4))
w <- od_REX(Fx)$w.best
od_plot(Fx, w, Fx[, 2:3], dd.size=3)
od_plot(Fx, w, Fx[, 2:4], w.lim=Inf)
# A more complex example:
# Compute the D-optimal 17 point exact design
# for the spring-balance weighing model with 4 items
Fx <- Fx_cube(~x1 + x2 + x3 + x4 - 1, lower = rep(0, 4))
w <- od_KL(Fx, 17, t.max = 5)$w.best
od_print(Fx, w)$design
U <- eigen(diag(4) - 0.25 * rep(1, 4)
# A 2D visualization
X <- Fx[, 1:4]
X[, 2] <- -2*X[, 2]
colnames(X) <- c("V", "Number of items on the pan")
od_plot(Fx, w+0.001, X)
for(i in 1:16) for(j in 1:16)
if(sum(abs(Fx[i,1:4]-Fx[j,1:4]))==1)
lines(X[c(i,j),1], X[c(i,j),2])
# A 3D visualization
X <- Fx[, 1:4]
colnames(X) <- c("V1", "V2", "V3")
od_plot(Fx, w+0.001, X)
for(i in 1:16) for(j in 1:16)
if(sum(abs(Fx[i, 1:4] - Fx[j, 1:4])) == 1)
rgl::lines3d(X[c(i, j), 1], X[c(i, j), 2], X[c(i, j), 3])
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.