Replies: 1 comment
-
I've made some digging in other threads, and from #165 and #300, it seems the key issue is in the calculation of the log likelihood with frequency models (such as log binomial, poisson, negative binomial...):
So can I ask for frequency based model (in particular negative binomial), how should the log likelihood and R2 be calculated? Should I use the suggested offset of log (N choose k) in #165 ? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
(Moved from issue #852 to discussion)
I am trying to use Nagelkerke's R2 for some general linear models (negbinom) using$R^2_{CS}$ ) and Nagelkerke's R2 ($R^2_N$ ) are as follows (ref):
performance::r2_nagelkerke
.The formula to Cox & Snell's R2 (
Based on the source code to
r2_nagelkerke.glm
, I can benchmark the following calculation:I understand that the deviance is different from log likelihood and can be calculated from difference of log-likelihood (see link), with
$\text{dev} = 2 \times \left( \text{logLik}(M_{saturated}) - \text{logLik}(M_{proposed}) \right)$
For Cox & Snell's R2 (CS R2), the result should be the same, as the common term of$\text{logLik}(M_{saturated})$ is cancelled:
However, with Nagelkerke's R2, wouldn't dividing the$R^2_{CS}$ with$1 - \text{exp} \left(- \frac{\text{dev} (M_{null}) } {n} \right)$ be different from $1 - \text{exp} \left(\frac{2}{n} \times \text{logLik}(M_{null})\right)$ ?
Beta Was this translation helpful? Give feedback.
All reactions