View source: R/CVBFFunctions.R
laplace.kernH2c | R Documentation |
Compute Marginal Likelihoods for CVBF
laplace.kernH2c(y, x, hhat, c)
y |
Validation Set |
x |
Training set |
hhat |
Bandwidth parameter that maximizes the log likelihood |
c |
A constant that is equal to the log likelihood + log prior evaluated at the maximum |
Evaluation of the CVBF marginal likelihood via Laplace Approximation. Also returns bandwidth that maximized log integrand, and hessian of log integrand at maximum.
dataset1 = rnorm(100)
DT = dataset1[1:50]
DV = dataset1[51:100]
likvec = function(h) {sum(log(HallKernel(h,datagen2 = DT, x = DT)))}
bwlikcy = optimize(f = function(h){ likvec(h)}, lower = 0, upper = 10, maximum = TRUE)
ExpectedKernML2 = laplace.kernH2c(y = DT, x = DV, hhat = bwlikcy$maximum, c= bwlikcy$objective + logpriorused(h = bwlikcy$maximum, hhat = bwlikcy$maximum))
ExpectedKernML2
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.