| exp2d.rand {tgp} | R Documentation |
A Random subsample of data(exp2d), or
Latin Hypercube sampled data evaluated similarly
exp2d.rand(n1 = 50, n2 = 30, lh=NULL)
n1 |
Number of samples from the first, interesting, quadrant |
n2 |
Number of samples from the other three, uninteresting, quadrants |
lh |
If !is.null(lh) then Latin Hypercube sampling
(lhs) is used instead of subsampling from
data(exp2d); lh should be a single positive
integer specifying the desired number of predictive locations,
XX; or, it should be a vector of length 4, specifying the
number of predictive locations desired from each of the four
quadrants (interesting quadrant first, then counter-clockwise) |
When is.null(lh), data is subsampled without replacement from
data(exp2d).
Of the n1 + n2 <= 441 input/response pairs X,Z, n1
are taken from the first quadrant, i.e., where the response is interesting,
and the remaining n1 are taken from the other three quadrant. The
remaining 441 - (n1 + n2) are treated as predictive locations
Otherwise, when !is.null(lh), Latin Hypercube Sampling
(lhs) is used
In both cases, the response is evaluated as
Z(X) = X1 * exp(-X1^2 -X2^2),
thus creating the outputs Ztruth and ZZtruth.
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 data.frame with n1 + n2 input locations |
Z |
Numeric vector describing the responses (with noise) at the
X input locations |
Ztrue |
Numeric vector describing the true responses (without
noise) at the X input locations |
XX |
2-d data.frame containing the remaining
441 - (n1 + n2) input locations |
ZZ |
Numeric vector describing the responses (with noise) at
the XX predictive locations |
ZZtrue |
Numeric vector describing the responses (without
noise) at the XX predictive locations |
Robert B. Gramacy rbgramacy@ams.ucsc.edu
Gramacy, R. B., Lee, H. K. H. (2006). Bayesian treed Gaussian process models. Available as UCSC Technical Report ams2006-01.
http://www.ams.ucsc.edu/~rbgramacy/tgp.html
lhs, exp2d, link{exp2d.Z},
tgp, 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(5, 10, 15, 20))
# 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)