Learn R Programming

GPpenalty (version 1.0.1)

predict_gp: predict_gp

Description

Computes the posterior mean and covariance matrix for a given set of input locations based on a fitted model.

Usage

predict_gp(out, xx)

Value

A list of predictive posterior mean and covariance:

  • mup: vector of predicted posterior mean

  • Sigmap: predictive posterior covariance matrix

  • R: predictive posterior covariance matrix with the scale parameter removed

Arguments

out

out from mle_gp or mle_gp.

xx

A numerical vector or matrix of new input locations.

Details

From the model fitted by mle_gp or mle_gp, the posterior mean and covariance matrix are computed.

Examples

Run this code

### test function ###
f_x <- function(x) {
return(sin(2*pi*x) + x^2)
}

### training data ###
n <- 8
x <- runif(n, 0, 1)
y <- f_x(x)

### testing data ###
n.test <- 100
x.test <- runif(n.test, 0, 1)
y.test <- f_x(x.test)

### get parameter estimates ###
out <- mle_gp(y, x)

### prediction ###
pred <- predict_gp(out, x.test)


Run the code above in your browser using DataLab