predict.gp | R Documentation |
Gaussian Process Predictions
## S3 method for class 'gp' predict(object, newData = object$X, se.fit = FALSE, ...)
object |
an object of class |
newData |
an optional data frame or matrix with rows corresponding to inputs for which to predict.
If omitted, the design matrix |
se.fit |
a switch indicating if standard errors are desired |
... |
for compatibility with generic method |
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.
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 |
for predictions with gp.list
objects, call predict.gp
separately for each gp in the list
Garrett M. Dancik dancikg@easternct.edu
https://github.com/gdancik/mlegp/
For cross-validated predictions, see CV
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.