Learn R Programming

gspcr (version 0.9.5)

LL_binomial: Binomial log-likelihood

Description

Computes the binomial log-likelihood given a response vector and corresponding GLM linear predictor values.

Usage

LL_binomial(y, x, mod)

Value

A list containing:

  • ll an atomic vector of length 1 containing the log-likelihood value.

  • sc an atomic vector containing the systematic component for the input x and mod.

Arguments

y

numeric vector (or factor) recording a binary dependent variable.

x

data.frame (or matrix) containing predictor values.

mod

glm object containing and estimated logistic regression model.

Author

Edoardo Costantini, 2022

Details

If x and y are equal to the data on which mod has been trained, this function returns the same result as the default logLink function. If x and y are new, the function returns the log-likelihood of the new data under the trained model. The log-likelihood equation is based on Agresti (2002, p. 192).

References

Agresti, A. (2012). Categorical data analysis (Vol. 792). John Wiley & Sons.