This release corrects six numerical defects. The user-facing API is unchanged: no functions were added, removed or renamed.
Critical fixes
dgkw() returned 0 for every input. The internal helpers log1mexp() and log1pexp() collide with functions of the same name in R's public Rmath.h API, which use the convention log(1 - exp(-x)) for x >= 0. Where that macro was active the calls resolved to R's version, which returns NaN for the negative arguments used here, so every density evaluation failed its finiteness guard. The helpers are now gkw_log1mexp() and gkw_log1pexp(). The sub-family densities and llgkw() were unaffected.
EKw, KKw and BKw log-likelihoods were wrong for data near zero. These routines clamped 1 - x^alpha and 1 - (1 - x^alpha)^beta at 1e-10 instead of working in log space. For small x and moderate alpha those round to 1 and 0 in double precision, so the clamp substituted log(1e-10) = -23 for values near -53. Deviations reached 6,100 log-units, which corrupts AIC, BIC and likelihood ratio tests.
Mixed second derivatives were zeroed at degenerate parameter values. Guards of the form if (abs(p - 1) > eps) gated terms that do not carry the vanishing factor: differentiating (gamma-1)*log(w) once in gamma consumes the (gamma-1), so the term survives at gamma = 1. hsbkw() returned 0 where the correct value was 271.12; hsekw() and hskkw() had the same defect at beta = 1.
Also fixed: arbitrary min(., 1000) clamps in grkkw() and llkkw(); a skipped block in grkkw()/hskkw() at delta = 0; and check_beta_pars(), which rejected delta = 0, the valid Beta(gamma, 1) boundary.
Validation
Every gradient component and every Hessian entry of all seven sub-families is now checked individually against two independent references: the general GKw routines restricted to the constrained parameter point, and numDeriv Richardson extrapolation. Grids cover the degenerate values gamma = 1, beta = 1, lambda = 1 and delta = 0, and samples with observations near zero.
| Family | log-likelihood | gradient | Hessian |
|---|---|---|---|
| GKw | 1.5e-11 | 1.5e-08 | 1.5e-07 |
| BKw | 1.6e-12 | 3.7e-08 | 3.6e-08 |
| KKw | 3.1e-13 | 3.5e-08 | 4.9e-08 |
| EKw | 5.4e-14 | 7.8e-09 | 2.7e-08 |
| Mc | 3.5e-13 | 2.5e-09 | 9.5e-10 |
| Kw | 4.1e-15 | 7.2e-10 | 1.2e-09 |
| Beta | 7.2e-15 | 4.6e-10 | 8.9e-11 |
Against the GKw reference all seven families agree to 1e-13; the residual error versus numDeriv is at the accuracy limit of Richardson extrapolation itself. Densities are additionally checked to integrate to one and to reproduce base R for the Beta and closed-form Kumaraswamy cases. Coverage rose from 70.8% to 74.2%.
Documentation
The JOSS manuscript was rewritten, CONTRIBUTING.md and CODE_OF_CONDUCT.md were added, and the README performance claim was corrected: the previous benchmark compared C++ against C++ plus R loop overhead. The real gain is in the derivatives, where the analytical score is about 9x faster than Richardson extrapolation and the analytical Hessian about 38x faster.
Full changelog: https://github.com/evandeilton/gkwdist/blob/main/NEWS.md