View source: R/NuggetKrigingClass.R
logLikelihoodFun.NuggetKriging | R Documentation |
Compute Log-Likelihood of NuggetKriging Model
## S3 method for class 'NuggetKriging'
logLikelihoodFun(object, theta_alpha, return_grad = FALSE, bench = FALSE, ...)
object |
An S3 NuggetKriging object. |
theta_alpha |
A numeric vector of (positive) range parameters and variance over variance plus nugget at which the log-likelihood will be evaluated. |
return_grad |
Logical. Should the function return the gradient? |
bench |
Logical. Should the function display benchmarking output |
... |
Not used. |
The log-Likelihood computed for given
\boldsymbol{theta_alpha}
.
Yann Richet yann.richet@irsn.fr
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) + 0.1 * rnorm(nrow(X))
k <- NuggetKriging(y, X, kernel = "matern3_2")
print(k)
theta0 = k$theta()
ll_alpha <- function(alpha) logLikelihoodFun(k,cbind(theta0,alpha))$logLikelihood
a <- seq(from = 0.9, to = 1.0, length.out = 101)
plot(a, Vectorize(ll_alpha)(a), type = "l",xlim=c(0.9,1))
abline(v = k$sigma2()/(k$sigma2()+k$nugget()), col = "blue")
alpha0 = k$sigma2()/(k$sigma2()+k$nugget())
ll_theta <- function(theta) logLikelihoodFun(k,cbind(theta,alpha0))$logLikelihood
t <- seq(from = 0.001, to = 2, length.out = 101)
plot(t, Vectorize(ll_theta)(t), type = 'l')
abline(v = k$theta(), col = "blue")
ll <- function(theta_alpha) logLikelihoodFun(k,theta_alpha)$logLikelihood
a <- seq(from = 0.9, to = 1.0, length.out = 31)
t <- seq(from = 0.001, to = 2, length.out = 101)
contour(t,a,matrix(ncol=length(a),ll(expand.grid(t,a))),xlab="theta",ylab="sigma2/(sigma2+nugget)")
points(k$theta(),k$sigma2()/(k$sigma2()+k$nugget()),col='blue')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.