GauPro_base {GauPro}R Documentation

Class providing object with methods for fitting a GP model

Description

Class providing object with methods for fitting a GP model

Class providing object with methods for fitting a GP model

Format

R6Class object.

Value

Object of R6Class with methods for fitting GP model.

Methods

new(X, Z, corr="Gauss", verbose=0, separable=T, useC=F,useGrad=T, parallel=T, nug.est=T, ...)

This method is used to create object of this class with X and Z as the data.

update(Xnew=NULL, Znew=NULL, Xall=NULL, Zall=NULL, restarts = 5, param_update = T, nug.update = self$nug.est)

This method updates the model, adding new data if given, then running optimization again.

Public fields

X

Design matrix

Z

Responses

N

Number of data points

D

Dimension of data

nug.min

Minimum value of nugget

nug

Value of the nugget, is estimated unless told otherwise

verbose

0 means nothing printed, 1 prints some, 2 prints most.

useGrad

Should grad be used?

useC

Should C code be used?

parallel

Should the code be run in parallel?

parallel_cores

How many cores are there? It will self detect, do not set yourself.

nug.est

Should the nugget be estimated?

param.est

Should the parameters be estimated?

mu_hat

Mean estimate

s2_hat

Variance estimate

K

Covariance matrix

Kchol

Cholesky factorization of K

Kinv

Inverse of K

Methods

Public methods


Method corr_func()

Correlation function

Usage
GauPro_base$corr_func(...)
Arguments
...

Does nothing


Method new()

Create GauPro object

Usage
GauPro_base$new(
  X,
  Z,
  verbose = 0,
  useC = F,
  useGrad = T,
  parallel = FALSE,
  nug = 1e-06,
  nug.min = 1e-08,
  nug.est = T,
  param.est = TRUE,
  ...
)
Arguments
X

Matrix whose rows are the input points

Z

Output points corresponding to X

verbose

Amount of stuff to print. 0 is little, 2 is a lot.

useC

Should C code be used when possible? Should be faster.

useGrad

Should the gradient be used?

parallel

Should code be run in parallel? Make optimization faster but uses more computer resources.

nug

Value for the nugget. The starting value if estimating it.

nug.min

Minimum allowable value for the nugget.

nug.est

Should the nugget be estimated?

param.est

Should the kernel parameters be estimated?

...

Not used


Method initialize_GauPr()

Not used

Usage
GauPro_base$initialize_GauPr()

Method fit()

Fit the model, never use this function

Usage
GauPro_base$fit(X, Z)
Arguments
X

Not used

Z

Not used


Method update_K_and_estimates()

Update Covariance matrix and estimated parameters

Usage
GauPro_base$update_K_and_estimates()

Method predict()

Predict mean and se for given matrix

Usage
GauPro_base$predict(XX, se.fit = F, covmat = F, split_speed = T)
Arguments
XX

Points to predict at

se.fit

Should the se be returned?

covmat

Should the covariance matrix be returned?

split_speed

Should the predictions be split up for speed


Method pred()

Predict mean and se for given matrix

Usage
GauPro_base$pred(XX, se.fit = F, covmat = F, split_speed = T)
Arguments
XX

Points to predict at

se.fit

Should the se be returned?

covmat

Should the covariance matrix be returned?

split_speed

Should the predictions be split up for speed


Method pred_one_matrix()

Predict mean and se for given matrix

Usage
GauPro_base$pred_one_matrix(XX, se.fit = F, covmat = F)
Arguments
XX

Points to predict at

se.fit

Should the se be returned?

covmat

Should the covariance matrix be returned?


Method pred_mean()

Predict mean

Usage
GauPro_base$pred_mean(XX, kx.xx)
Arguments
XX

Points to predict at

kx.xx

Covariance matrix between X and XX


Method pred_meanC()

Predict mean using C code

Usage
GauPro_base$pred_meanC(XX, kx.xx)
Arguments
XX

Points to predict at

kx.xx

Covariance matrix between X and XX


Method pred_var()

Predict variance

Usage
GauPro_base$pred_var(XX, kxx, kx.xx, covmat = F)
Arguments
XX

Points to predict at

kxx

Covariance matrix of XX with itself

kx.xx

Covariance matrix between X and XX

covmat

Not used


Method pred_LOO()

Predict at X using leave-one-out. Can use for diagnostics.

Usage
GauPro_base$pred_LOO(se.fit = FALSE)
Arguments
se.fit

Should the standard error and t values be returned?


Method plot()

Plot the object

Usage
GauPro_base$plot(...)
Arguments
...

Parameters passed to cool1Dplot(), plot2D(), or plotmarginal()


Method cool1Dplot()

Make cool 1D plot

Usage
GauPro_base$cool1Dplot(
  n2 = 20,
  nn = 201,
  col2 = "gray",
  xlab = "x",
  ylab = "y",
  xmin = NULL,
  xmax = NULL,
  ymin = NULL,
  ymax = NULL
)
Arguments
n2

Number of things to plot

nn

Number of things to plot

col2

color

xlab

x label

ylab

y label

xmin

xmin

xmax

xmax

ymin

ymin

ymax

ymax


Method plot1D()

Make 1D plot

Usage
GauPro_base$plot1D(
  n2 = 20,
  nn = 201,
  col2 = 2,
  xlab = "x",
  ylab = "y",
  xmin = NULL,
  xmax = NULL,
  ymin = NULL,
  ymax = NULL
)
Arguments
n2

Number of things to plot

nn

Number of things to plot

col2

Color of the prediction interval

xlab

x label

ylab

y label

xmin

xmin

xmax

xmax

ymin

ymin

ymax

ymax


Method plot2D()

Make 2D plot

Usage
GauPro_base$plot2D()

Method loglikelihood()

Calculate the log likelihood, don't use this

Usage
GauPro_base$loglikelihood(mu = self$mu_hat, s2 = self$s2_hat)
Arguments
mu

Mean vector

s2

s2 param


Method optim()

Optimize parameters

Usage
GauPro_base$optim(
  restarts = 5,
  param_update = T,
  nug.update = self$nug.est,
  parallel = self$parallel,
  parallel_cores = self$parallel_cores
)
Arguments
restarts

Number of restarts to do

param_update

Should parameters be updated?

nug.update

Should nugget be updated?

parallel

Should restarts be done in parallel?

parallel_cores

If running parallel, how many cores should be used?


Method optimRestart()

Run a single optimization restart.

Usage
GauPro_base$optimRestart(
  start.par,
  start.par0,
  param_update,
  nug.update,
  optim.func,
  optim.grad,
  optim.fngr,
  lower,
  upper,
  jit = T
)
Arguments
start.par

Starting parameters

start.par0

Starting parameters

param_update

Should parameters be updated?

nug.update

Should nugget be updated?

optim.func

Function to optimize.

optim.grad

Gradient of function to optimize.

optim.fngr

Function that returns the function value and its gradient.

lower

Lower bounds for optimization

upper

Upper bounds for optimization

jit

Is jitter being used?


Method update()

Update the model, can be data and parameters

Usage
GauPro_base$update(
  Xnew = NULL,
  Znew = NULL,
  Xall = NULL,
  Zall = NULL,
  restarts = 5,
  param_update = self$param.est,
  nug.update = self$nug.est,
  no_update = FALSE
)
Arguments
Xnew

New X matrix

Znew

New Z values

Xall

Matrix with all X values

Zall

All Z values

restarts

Number of optimization restarts

param_update

Should the parameters be updated?

nug.update

Should the nugget be updated?

no_update

Should none of the parameters/nugget be updated?


Method update_data()

Update the data

Usage
GauPro_base$update_data(Xnew = NULL, Znew = NULL, Xall = NULL, Zall = NULL)
Arguments
Xnew

New X matrix

Znew

New Z values

Xall

Matrix with all X values

Zall

All Z values


Method update_corrparams()

Update the correlation parameters

Usage
GauPro_base$update_corrparams(...)
Arguments
...

Args passed to update


Method update_nugget()

Update the nugget

Usage
GauPro_base$update_nugget(...)
Arguments
...

Args passed to update


Method deviance_searchnug()

Optimize deviance for nugget

Usage
GauPro_base$deviance_searchnug()

Method nugget_update()

Update the nugget

Usage
GauPro_base$nugget_update()

Method grad_norm()

Calculate the norm of the gradient at XX

Usage
GauPro_base$grad_norm(XX)
Arguments
XX

Points to calculate at


Method sample()

Sample at XX

Usage
GauPro_base$sample(XX, n = 1)
Arguments
XX

Input points to sample at

n

Number of samples


Method print()

Print object

Usage
GauPro_base$print()

Method clone()

The objects of this class are cloneable with this method.

Usage
GauPro_base$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples

#n <- 12
#x <- matrix(seq(0,1,length.out = n), ncol=1)
#y <- sin(2*pi*x) + rnorm(n,0,1e-1)
#gp <- GauPro(X=x, Z=y, parallel=FALSE)

[Package GauPro version 0.2.12 Index]