neg_log_likelihood.GPModel: Evaluate the negative log-likelihood

View source: R/GPModel.R

neg_log_likelihood.GPModelR Documentation

Evaluate the negative log-likelihood

Description

Evaluate the negative log-likelihood. If there is a linear fixed effects predictor term, this needs to be calculated "manually" prior to calling this function (see example below)

Usage

## S3 method for class 'GPModel'
neg_log_likelihood(gp_model, cov_pars, y,
  fixed_effects = NULL, aux_pars = NULL)

Arguments

gp_model

A GPModel

cov_pars

A vector with numeric elements. Covariance parameters of Gaussian process and random effects

y

A vector with response variable data

fixed_effects

A vector of optional external fixed effects (length = number of data points)

aux_pars

A vector with numeric elements. Additional parameters for non-Gaussian likelihoods (e.g., shape parameter of gamma likelihood)

Value

A GPModel

Author(s)

Fabio Sigrist

Examples


data(GPBoost_data, package = "gpboost")
gp_model <- GPModel(group_data = group_data, likelihood="gaussian")
X1 <- cbind(rep(1,dim(X)[1]), X)
coef <- c(0.1, 0.1, 0.1)
fixed_effects <- as.numeric(X1 %*% coef)
neg_log_likelihood(gp_model, y = y, cov_pars = c(0.1,1,1), 
                   fixed_effects = fixed_effects)


gpboost documentation built on Oct. 24, 2023, 9:09 a.m.