Learn R Programming

tgp (version 1.1-11)

exp2d.rand: Random 2-d Exponential Data

Description

A Random subsample of data(exp2d), or Latin Hypercube sampled data evaluated similarly

Usage

exp2d.rand(n1 = 50, n2 = 30, lh=NULL)

Arguments

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 positi

Value

  • Output is a list with entries:
  • X2-d data.frame with n1 + n2 input locations
  • ZNumeric vector describing the responses (with noise) at the X input locations
  • ZtrueNumeric vector describing the true responses (without noise) at the X input locations
  • XX2-d data.frame containing the remaining 441 - (n1 + n2) input locations
  • ZZNumeric vector describing the responses (with noise) at the XX predictive locations
  • ZZtrueNumeric vector describing the responses (without noise) at the XX predictive locations

Details

When is.null(lh), data is subsampled without replacement from data(exp2d). Of the n1 + n2 <= 441<="" code=""> 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)=x_1 * \exp(x_1^2-x_2^2).$$ thus creating the outputs Ztruth and ZZtruth. Zero-mean normal noise with sd=0.001 is added to the responses Z and ZZ

References

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

See Also

lhs, exp2d, link{exp2d.Z}, tgp, btgp, and other b* functions

Examples

Run this code
## 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)

Run the code above in your browser using DataLab