Returns a function that computes the log-likelihood of the data given the distribution parameters. The log-likelihood for survival data is:
Usage
# S3 method for class 'dfr_dist'
loglik(model, ...)Value
A function that computes the log-likelihood. It accepts:
- df: A data frame with observation times and censoring indicators
(delta: 1 = exact, 0 = right-censored, -1 = left-censored)
- par: The parameters of the distribution
- ...: Additional arguments passed to internal functions
Details
For exact observations (uncensored): log(f(t)) = log(h(t)) - H(t) For right-censored observations: log(S(t)) = -H(t) For left-censored observations: log(F(t)) = log(1 - exp(-H(t)))
where h(t) is the hazard function, H(t) is the cumulative hazard, f(t) = h(t)*S(t) is the pdf, and S(t) = exp(-H(t)) is the survival function.