Kriging::logMargPostFun

Description

Compute the Log-Marginal Posterior Density of a Kriging Model Object for a given Vector \(\boldsymbol{\theta}\) of Correlation Ranges

Usage

  • Python

    # k = Kriging(...)
    k.logMargPostFun(theta, return_grad = False)
    
  • R

    # k = Kriging(...)
    k$logMargPostFun(theta, return_grad = FALSE)
    
  • Matlab/Octave

    % k = Kriging(...)
    k.logMargPostFun(theta, return_grad = false)
    

Arguments

Argument

Description

theta

Numeric vector of correlation range parameters at which the function is to be evaluated.

return_grad

Logical. Should the function return the gradient (w.r.t theta)?

Details

The log-marginal posterior density relates to the jointly robust prior \(\pi_{\texttt{JR}}(\boldsymbol{\theta},\, \sigma^2, \, \boldsymbol{\beta}) \propto \pi(\boldsymbol{\theta}) \, \sigma^{-2}\). The marginal (or integrated) posterior is the function \(\boldsymbol{\theta}\) obtained by marginalizing out the GP variance \(\sigma^2\) and the vector \(\boldsymbol{\beta}\) of trend coefficients. Due to the form of the prior, the marginalization can be done on the likelihood \(p_{\texttt{marg}}(\boldsymbol{\theta}\,\vert \,\mathbf{y}) \propto \pi(\boldsymbol{\theta}) \times L_{\texttt{marg}}(\boldsymbol{\theta};\,\mathbf{y})\).

Value

The value of the log-marginal posterior density \(\log p_{\texttt{marg}}(\boldsymbol{\theta} \,|\, \mathbf{y})\). By maximizing this function we should get the estimate of \(\boldsymbol{\theta}\) obtained when using objective = "LMP" in the fit.Kriging method.

Examples

f <- function(x) 1 - 1 / 2 * (sin(12 * x) / (1 + x) + 2 * cos(7 * x) * x^5 + 0.7)
set.seed(123)
X <- as.matrix(runif(10))
y <- f(X)

k <- Kriging(y, X, "matern3_2", objective="LMP")
print(k)

lmp <- function(theta) k$logMargPostFun(theta)$logMargPost

t <- seq(from = 0.01, to = 2, length.out = 101)
plot(t, lmp(t), type = "l")
abline(v = k$theta(), col = "blue")

Results

* data: 10x[0.0455565,0.940467] -> 10x[0.194057,1.00912]
* trend constant (est.): 0.388566
* variance (est.): 0.158896
* covariance:
  * kernel: matern3_2
  * range (est.): 0.313364
  * fit:
    * objective: LMP
    * optim: BFGS