if (FALSE) {
# The directional derivatives of the D-optimal approximate design
# for a cubic regression on a square grid.
form.cube <- ~x1 + x2 + I(x1^2) + I(x2^2) + I(x1*x2) +
I(x1^3) + I(x1^2*x2) + I(x1*x2^2) + I(x2^3)
Fx <- Fx_cube(form.cube, n.levels = c(101, 101))
w <- od_REX(Fx)$w.best
# Because w is optimal approximate, no directional derivative is positive:
boxplot(dirder(Fx, w))
# The yellow values indicate the directional derivative at each design point:
od_plot(Fx, w, Fx[, 2:3])
# An alternative view is a "projection" of the above plot:
od_plot(Fx, w, Fx[, 2], dd.pool = c("max", "min"))
}
Run the code above in your browser using DataLab