predict.gp {spectralGP} | R Documentation |
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).
predict.gp(object,newdata=NULL,mapping=NULL,...)
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. |
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.
A vector of process values (matrix for two-dimensional processes in which prediction on the grid is requested).
Christopher Paciorek paciorek@alumni.cmu.edu
Type 'citation("spectralGP")' for references.
##---- Should be DIRECTLY executable !! ---- ##-- ==> Define data, use random, ##-- or do help(data=index) for the standard data sets. ## The function is currently defined as 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)