loglik_lr: Bernoulli distribution log-likelihood

View source: R/LogisticRegression.R

loglik_lrR Documentation

Bernoulli distribution log-likelihood

Description

Log-likelihood of the Bernoulli distribution, commonly used in optimisation procedures for maximisation.

Usage

loglik_lr(theta, x, y)

Arguments

theta

parameters relating to x

x

explanatory variables in model matrix

y

binary response variable

Details

The log-likelihood is written

\sum_{i=1}^n y \log(\sigma(X\beta)) + (1-y) \log(1-\sigma(X\beta))

Value

single value, the log-likelihood of the Bernoulli distribution with fixed x and y

Examples

theta = c(1, 0.1)
X = matrix(rnorm(4), 50, 2)
y = sample(0:1, 50, replace=TRUE)
loglik_lr(theta, X, y)

dannyjameswilliams/danielR documentation built on Aug. 20, 2023, 3:25 a.m.