loglik_lr: Bernoulli distribution log-likelihood

Description Usage Arguments Details Value Examples

View source: R/LogisticRegression.R

Description

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

Usage

1
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

∑_{i=1}^n y \log(σ(Xβ)) + (1-y) \log(1-σ(Xβ))

Value

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

Examples

1
2
3
4
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 Feb. 1, 2021, 6:39 p.m.