Learn R Programming

emulator (version 1.2-24)

sample.n.fit: Sample from a Gaussian process and fit an emulator to the points

Description

Sample 'n' fit: sample from an appropriate multivariate Gaussian process in one dimension, then fit an emulator to it.

Usage

sample.n.fit(n = 10, scales.generate = 100, scales.fit = 100, func = regressor.basis, ...)

Arguments

n

Number of observations to make

scales.generate

Scales to generate the data with: small values give uncorrelated observations, large values give correlated observations (hence the points fall on a smooth line)

scales.fit

Scales to use to fit the emulator. Small values give an emulator that is the prior with short, sharp excursions to make the emulator go through the points; large values give smooth emulators that exhibit overshoots resembling Gibbs's phenomenon

func

Function used to determine basis vectors, defaulting to regressor.basis if not given.

...

Further arguments passed to plot().

Author

Robin K. S. Hankin

Details

The point of this function is to investigate what happens when inappropriate scales are used for the emulator: that is, when scales.generate and scales.fit are wildly different.

Note that the sampling distribution has a constant expectation (of zero); so the prior should be zero, making it easy to see mispredictions of beta.

Examples

Run this code

sample.n.fit(main="Default: scales match")
sample.n.fit(scales.generate=5,main="generate scale small")

# Now use a quadratic function instead of the default linear:
 f <- function(x){out <- c(1,x,x^2)
 names(out) <- c("const","linear","quadratic")
 out}

sample.n.fit(main="quadratic prior" , func=f)


Run the code above in your browser using DataLab