exp2d.rand | R Documentation |
A Random subsample of data(exp2d)
, or
Latin Hypercube sampled data evaluated with exp2d.Z
exp2d.rand(n1 = 50, n2 = 30, lh = NULL, dopt = 1)
n1 |
Number of samples from the first, interesting, quadrant |
n2 |
Number of samples from the other three, uninteresting, quadrants |
lh |
If |
dopt |
If |
When is.null(lh)
, data is subsampled without replacement from
data(exp2d)
. Of the n1 + n2 <= 441
input/response pairs X,Z
, there are n1
are taken from the
first quadrant, i.e., where the response is interesting,
and the remaining n2
are taken from the other three
quadrants. The remaining 441 - (n1 + n2)
are treated as
predictive locations
Otherwise, when !is.null(lh)
, Latin Hypercube Sampling
(lhs
) is used
If dopt >= 2
then n1*dopt
LH candidates are used
for to get a D-optimal subsample of size n1
from the
first (interesting) quadrant. Similarly n2*dopt
in the
rest of the un-interesting region.
A total of lh*dopt
candidates will be used for sequential D-optimal
subsampling for predictive locations XX
in all four
quadrants assuming the already-sampled X
locations will
be in the design.
In all three cases, the response is evaluated as
Z(X)=x_1 * \exp(x_1^2-x_2^2).
thus creating the outputs Ztrue
and ZZtrue
.
Zero-mean normal noise with sd=0.001
is added to the
responses Z
and ZZ
Output is a list
with entries:
X |
2-d |
Z |
Numeric vector describing the responses (with noise) at the
|
Ztrue |
Numeric vector describing the true responses (without
noise) at the |
XX |
2-d |
ZZ |
Numeric vector describing the responses (with noise) at
the |
ZZtrue |
Numeric vector describing the responses (without
noise) at the |
Robert B. Gramacy, rbg@vt.edu, and Matt Taddy, mataddy@amazon.com
Gramacy, R. B. (2007). tgp: An R Package for Bayesian Nonstationary, Semiparametric Nonlinear Regression and Design by Treed Gaussian Process Models. Journal of Statistical Software, 19(9). https://www.jstatsoft.org/v19/i09 \Sexpr[results=rd]{tools:::Rd_expr_doi("10.18637/jss.v019.i09")}
Robert B. Gramacy, Matthew Taddy (2010). Categorical Inputs, Sensitivity Analysis, Optimization and Importance Tempering with tgp Version 2, an R Package for Treed Gaussian Process Models. Journal of Statistical Software, 33(6), 1–48. https://www.jstatsoft.org/v33/i06/ \Sexpr[results=rd]{tools:::Rd_expr_doi("10.18637/jss.v033.i06")}
Gramacy, R. B., Lee, H. K. H. (2008). Bayesian treed Gaussian process models with an application to computer modeling. Journal of the American Statistical Association, 103(483), pp. 1119-1130. Also available as ArXiv article 0710.4536 https://arxiv.org/abs/0710.4536
https://bobby.gramacy.com/r_packages/tgp/
lhs
, exp2d
, exp2d.Z
,
btgp
, and other b*
functions
## randomly subsampled data
## ------------------------
eds <- exp2d.rand()
# higher span = 0.5 required because the data is sparse
# and was generated randomly
eds.g <- interp.loess(eds$X[,1], eds$X[,2], eds$Z, span=0.5)
# perspective plot, and plot of the input (X & XX) locations
par(mfrow=c(1,2), bty="n")
persp(eds.g, main="loess surface", theta=-30, phi=20,
xlab="X[,1]", ylab="X[,2]", zlab="Z")
plot(eds$X, main="Randomly Subsampled Inputs")
points(eds$XX, pch=19, cex=0.5)
## Latin Hypercube sampled data
## ----------------------------
edlh <- exp2d.rand(lh=c(20, 15, 10, 5))
# higher span = 0.5 required because the data is sparse
# and was generated randomly
edlh.g <- interp.loess(edlh$X[,1], edlh$X[,2], edlh$Z, span=0.5)
# perspective plot, and plot of the input (X & XX) locations
par(mfrow=c(1,2), bty="n")
persp(edlh.g, main="loess surface", theta=-30, phi=20,
xlab="X[,1]", ylab="X[,2]", zlab="Z")
plot(edlh$X, main="Latin Hypercube Sampled Inputs")
points(edlh$XX, pch=19, cex=0.5)
# show the quadrants
abline(h=2, col=2, lty=2, lwd=2)
abline(v=2, col=2, lty=2, lwd=2)
## Not run:
## D-optimal subsample with a factor of 10 (more) candidates
## ---------------------------------------------------------
edlhd <- exp2d.rand(lh=c(20, 15, 10, 5), dopt=10)
# higher span = 0.5 required because the data is sparse
# and was generated randomly
edlhd.g <- interp.loess(edlhd$X[,1], edlhd$X[,2], edlhd$Z, span=0.5)
# perspective plot, and plot of the input (X & XX) locations
par(mfrow=c(1,2), bty="n")
persp(edlhd.g, main="loess surface", theta=-30, phi=20,
xlab="X[,1]", ylab="X[,2]", zlab="Z")
plot(edlhd$X, main="D-optimally Sampled Inputs")
points(edlhd$XX, pch=19, cex=0.5)
# show the quadrants
abline(h=2, col=2, lty=2, lwd=2)
abline(v=2, col=2, lty=2, lwd=2)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.