if (FALSE) {
# Example 1: randomly generated 2-variable response surface data
X <- cbind(runif(100, -2, 2), runif(100, -2, 2))
y <- as.matrix(72 - 11.78 * X[, 1] + 0.74 * X[, 2] - 7.25 * X[, 1]^2 -
7.55 * X[, 2]^2 - 4.85 * X[, 1] * X[, 2] + rnorm(100, 0, 8))
# Find a 95 percent confidence region for the maximum of a Thin Plate Spline
# model fitted to these data
out <- OptRegionTps(
X = X, y = y, nosim = 200, LB = c(-2, -2), UB = c(2, 2),
xlab = "X1", ylab = "X2"
)
# Example 2: a mixture-amount experiment in two components (Drug dataset) with
# non-normal data. Note triangular experimental region. Resulting 95p confidence
# region of the maxima of a TPS model has area > 0. Contrast with region for
# quadratic polynomial model. Note: 500 bootstrap iterations may take a few minutes.
out <- OptRegionTps(
X = Drug[, 1:2], y = Drug[, 3], nosim = 500, lambda = 0.05, LB = c(0, 0),
UB = c(0.08, 11), xlab = "Component 1 (mg.)", ylab = "Component 2 (mg.)",
triangularRegion = TRUE, vertex1 = c(0.02, 11), vertex2 = c(0.08, 1.8),
outputPDFFile = "Mixture_plot.pdf"
)
}
Run the code above in your browser using DataLab