Skip to content

r2_nagelkerke.glm #300

@SingerAl

Description

@SingerAl

Dear performance package authors,
thank you for developping the performance package.
Testing function 'r2_nagelkerke' I had an issue with the outcome.
The critical code line is: r2_nagelkerke <- r2cox/(1 - exp(-model$null.deviance/insight::n_obs(model)))
According to https://de.wikipedia.org/wiki/Pseudo-Bestimmtheitsma%C3%9F
the part (1 - exp(-model$null.deviance/insight::n_obs(model))) is wrong. The code should be something like
ll_null <- insight::loglikelihood(insight::null_model(model))
r2_nagelkerke <- r2cox/-expm1(2/insight::n_obs(model) * ll_null)
With best regards, Alex

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions