Skip to content

BUG in ucedergreen() function #48

@hreinwald

Description

@hreinwald

I found some bigger issues in the ucedergreen() function. I posted the issue in my drc re-factory repo as well.

1. Core Model Function (fct) — Missing + c term

The documented formula is:

$f(x) = c + d - \frac{d - c + f \exp(-1/x^{\alpha})}{1 + \exp(b(\log(x) - \log(e)))}$

The code computes only $d - \text{numTerm}/\text{denTerm}$, missing parmMat[, 2].
The fix is a single token: parmMat[, 2] + parmMat[, 3] - numTerm/denTerm.

2. edfct Signature Mismatch

The drc framework calls edfct(parm, respl, reference, type, ...) positionally.
ucedergreen() defines edfct(parm, p, ...), dropping reference and type entirely.
This will silently break ED calculations at runtime.

3. xlogx Called but Never Defined

deriv1 calls xlogx(...) but the helper is commented out. Any call to deriv1
will throw Error: could not find function "xlogx".

4. match.arg(method) Never Called

Unlike cedergreen(), ucedergreen() never validates the method argument.
Invalid strings pass silently and the default first-element selection never triggers.

5. | Instead of || in Argument Validation

Scalar if() guards use the vectorized | operator instead of the short-circuit ||,
which is a latent bug and produces warnings on non-scalar inputs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions