laplace.kernH2c: Compute Marginal Likelihoods for CVBF

View source: R/CVBFFunctions.R

laplace.kernH2cR Documentation

Compute Marginal Likelihoods for CVBF

Description

Compute Marginal Likelihoods for CVBF

Usage

laplace.kernH2c(y, x, hhat, c)

Arguments

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

Value

Evaluation of the CVBF marginal likelihood via Laplace Approximation. Also returns bandwidth that maximized log integrand, and hessian of log integrand at maximum.

Examples

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

naveedmerchant/BayesScreening documentation built on June 13, 2024, 7:56 a.m.