predict.gp: Prediction from a spectral GP object

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

Produces the process values of a spectral GP object on the defined grid or predicts process values for a new set of inputs (domain points).

Usage

1
2
## S3 method for class 'gp'
predict(object,newdata=NULL,mapping=NULL,...)

Arguments

object

A GP object, created by gp.

newdata

An optional two-column matrix-like object (vector for one-dimensional data) of locations of interest, for which the first column is the first coordinate and the second column the second coordinate. Locations should lie in (0,1)^d, as the process representation is on a grid on (0,1)^d.

mapping

Optional output of new.mapping, which creates a vector of indices mapping the prediction locations to their nearest gridpoints.

...

Other arguments.

Details

Does prediction for a spectral GP, either at the gridpoints or for locations by associating locations with the nearest gridpoint, depending on the arguments supplied. If newdata and mapping are both NULL, then prediction is done on the grid. If only newdata is supplied, the mapping is done using new.mapping and then the prediction is done. If mapping is supplied (this should be done for computational efficiency if prediction at the same locations will be done repeatedly) then the mapping is used directly to calculate the predictions.

Value

A vector of process values (matrix for two-dimensional processes in which prediction on the grid is requested).

Author(s)

Christopher Paciorek paciorek@alumni.cmu.edu

References

Type 'citation("spectralGP")' for references.

See Also

gp, new.mapping, plot.gp

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
library(spectralGP)
gp1=gp(128,matern.specdens,c(1,4))
gp2=gp(c(64,64),matern.specdens,c(1,4))
simulate(gp1)
simulate(gp2)
gridvals=predict(gp1)
gridvals2=predict(gp2)

loc1=runif(100)
loc2=cbind(runif(100),runif(100,0,1))
map1=new.mapping(gp1,loc1)
map2=new.mapping(gp2,loc2)
vals1=predict(gp1,mapping=map1)
vals2=predict(gp2,mapping=map2)
#equivalently:
vals1=predict(gp1,loc1)
vals2=predict(gp2,loc2)
plot(gp1)
points(loc1,vals1)

spectralGP documentation built on May 2, 2019, 2:40 a.m.