predict.gp {mlegp}R Documentation

Gaussian Process Predictions

Description

Gaussian Process Predictions

Usage

## S3 method for class 'gp'
predict(object, newData = object$X, se.fit = FALSE, ...)

Arguments

object

an object of class gp

newData

an optional data frame or matrix with rows corresponding to inputs for which to predict. If omitted, the design matrix X of object is used.

se.fit

a switch indicating if standard errors are desired

...

for compatibility with generic method predict

Details

The Gaussian process is used to predict output at the design points newData; if the logical se.fit is set to TRUE, standard errors (standard deviations of the predicted values) are also calculated. Note that if the Gaussian process contains a nugget term, these standard deviations correspond to standard deviations of predicted expected values, and NOT standard deviations of predicted observations. However, the latter can be obtained by noting that the variance of a predicted observation equals the variance of the predicted expected value plus a nugget term.

If newData is equal to the design matrix of object (the default), and there is no nugget term, the Gaussian process interpolates the observations and the predictions will be identical to component Z of object. For cross-validation, the function CV should be used.

Value

predict.gp produces a vector of predictions. If se.fit is TRUE, a list with the following components is returned:

fit

vector as above

se.fit

standard error of the predictions

Note

for predictions with gp.list objects, call predict.gp separately for each gp in the list

Author(s)

Garrett M. Dancik dancikg@easternct.edu

References

https://github.com/gdancik/mlegp/

See Also

For cross-validated predictions, see CV

Examples


x = -5:5; y = sin(x) + rnorm(length(x), sd = 0.001)
fit = mlegp(x,y)
predict(fit, matrix(c(2.4, 3.2)))
## predictions at design points match the observations 
## (because there is no nugget)
round(predict(fit) - fit$Z, 6)   

# this is not necessarily true if there is a nugget
fit = mlegp(x,y, min.nugget = 0.01)
round(predict(fit) - fit$Z,6)   


[Package mlegp version 3.1.9 Index]