# llikGP: Calculate a GP log likelihood In laGP: Local Approximate Gaussian Process Regression

## Description

Calculate a Gaussian process (GP) log likelihood or posterior probability with reference to a C-side GP object

## Usage

 ```1 2``` ```llikGP(gpi, dab = c(0, 0), gab = c(0, 0)) llikGPsep(gpsepi, dab = c(0, 0), gab = c(0, 0)) ```

## Arguments

 `gpi` a C-side GP object identifier (positive integer); e.g., as returned by `newGP` `gpsepi` similar to `gpi` but indicating a separable GP object `dab` `ab` for the lengthscale parameter, see Details `gab` `ab` for the nugget parameter, see Details

## Details

An “`ab`” parameter is a non-negative 2-vector describing shape and rate parameters to a Gamma prior; a zero-setting for either value results in no-prior being used in which case a log likelihood is returned. If both `ab` parameters are specified, then the value returned can be interpreted as a log posterior density. See `darg` for more information about `ab`

## Value

A real-valued scalar is returned.

## Author(s)

Robert B. Gramacy [email protected]

`mleGP`, `darg`
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21``` ```## partly following the example in mleGP library(MASS) ## motorcycle data and predictive locations X <- matrix(mcycle[,1], ncol=1) Z <- mcycle[,2] ## get sensible ranges d <- darg(NULL, X) g <- garg(list(mle=TRUE), Z) ## initialize the model gpi <- newGP(X, Z, d=d\$start, g=g\$start) ## calculate log likelihood llikGP(gpi) ## calculate posterior probability llikGP(gpi, d\$ab, g\$ab) ## clean up deleteGP(gpi) ```