Computes the log-likelihood for binary logistic regression.
L(beta|X,y) = sum(y*log(p) + (1-y)*log(1-p))
where p = sigmoid(X %*% beta)
Usage
loglik_logistic(beta, X, y)
Arguments
- beta
Coefficient vector (list of value objects)
- X
Design matrix (n x p numeric matrix)
- y
Binary response vector (0 or 1)
Value
A value object representing the log-likelihood
Details
Uses the numerically stable form:
log(p) = -log(1 + exp(-η)) and log(1-p) = -log(1 + exp(η))
where η = Xβ