Computes \(\log p(y_i \mid f_i)\) and its first three derivatives with respect to the latent values \(f_i\), the quantities that Laplace and related approximations need.
Arguments
- likelihood
A likelihood specification (gp_likelihoods).
- y
Responses, as the likelihood accepts them.
- f
Numeric vector of latent values, one per response.
- exposure
Optional positive exposure for Poisson likelihoods: one value or one per response.
Value
A data frame with one row per response: y in the internal coding
(0/1 for binary responses), f, log_density, and the derivatives
first, second, and third.
Stability
Experimental: this interface may change in a minor release, and every change is listed in NEWS. See gaussianprocesses-package for the policy.
Examples
f <- c(-40, -2, 0, 2, 40)
evaluate_likelihood(bernoulli_likelihood("probit"), rep(1, 5), f)
#> y f log_density first second third
#> 1 1 -40 -804.60844201 40.02496885 -0.9993773 3.101744e-05
#> 2 1 -2 -3.78318433 2.37321553 -0.8857209 5.935586e-02
#> 3 1 0 -0.69314718 0.79788456 -0.6366198 2.180136e-01
#> 4 1 2 -0.02301291 0.05524786 -0.1135481 1.843948e-01
#> 5 1 40 0.00000000 0.00000000 0.0000000 0.000000e+00
evaluate_likelihood(poisson_likelihood(), c(0, 1, 2, 3, 4), f = log(1:5),
exposure = 2)
#> y f log_density first second third
#> 1 0 0.0000000 -2.000000 -2 -2 -2
#> 2 1 0.6931472 -2.613706 -3 -4 -4
#> 3 2 1.0986123 -3.109628 -4 -6 -6
#> 4 3 1.3862944 -3.553435 -5 -8 -8
#> 5 4 1.6094379 -3.967713 -6 -10 -10