predict.tempGP {DSWE}R Documentation

predict from temporal Gaussian process

Description

predict function for tempGP objects. This function computes the prediction f(x) or f(x) + g(t) depending on the temporal distance between training and test points and whether the time indices for the test points are provided.

Usage

## S3 method for class 'tempGP'
predict(object, testX, testT = NULL, trainT = NULL, ...)

Arguments

object

An object of class tempGP.

testX

A matrix with each column corresponding to one input variable.

testT

A vector of time indices of the test points. When NULL, only function f(x) is used for prediction. Default is NULL.

trainT

Optional argument to override the existing trainT indices of the tempGP object.

...

additional arguments for future development

Value

A vector of predictions at the testpoints in testX.

Examples

   data = DSWE::data1
   trainindex = 1:100 #using the first 100 data points to train the model
   traindata = data[trainindex,]
   xCol = 2 #input variable columns
   yCol = 7 #response column
   trainX = as.matrix(traindata[,xCol])
   trainY = as.numeric(traindata[,yCol])
   tempGPObject = tempGP(trainX, trainY)
   testdata = DSWE::data1[101:110,] # defining test data 
   testX = as.matrix(testdata[,xCol, drop = FALSE])
   predF = predict(tempGPObject, testX)


[Package DSWE version 1.5.1 Index]