2

I am looking to get a pseudo $R^2$ metric from a beta-regression model fit using JAGS in the runjags package for R. To do so I have calculated the deviance of the fitted model, and the deviance of a null model. I plan to calculate McFadden's pseudo $R^2$ as

$$1-\frac{\text{Residual Deviance}}{\text{Null Deviance}}$$.

Where residual deviance is the deviance of the fitted model, and null deviance is the deviance of the null model. However, both of my deviance values are negative. Residual deviance = -6622.103 ans null deviance = -5939.539. So, 1 - (-6622.103/-5939.539) = -0.1149187. Negative $R^2$ values don't seem right.

colin
  • 862
  • 1
  • 11
  • 27

1 Answers1

5

The deviance should usually not become negative. Maybe you should check that all computations are correct.

Furthermore, the usual recommended pseudo $R^2$ for beta regression is not McFadden which is designed for categorical responses. Ferrari and Cribari-Neto (2004, p. 806) recommend to use the squared sample correlation between the linear predictor $\hat \eta$ and the link-transformed response $g(y)$. This is also what betareg computes.

Achim Zeileis
  • 13,510
  • 1
  • 29
  • 53
  • Thankyou, this is helpful. I read Ferrari and Cribari-Neto 2004, and noted their suggestion to use $\hat \eta$ and the link-transformed response $g(y)$. However, I could not figure out how these were calculated in their manuscript. Could you provide an example of how to calculate them in R? I need to implement this on the output of a JAGS model, rather than in `betareg`. – colin Aug 24 '16 at 00:45
  • 3
    Sure, I just included the pointer to `betareg` in case you wanted to look up the underlying R code. To compute $\hat \eta$ you just need `x %*% beta` (linear predictor for the mean equation) and if you use a logit link then $g(y)$ is `log(y/(1 - y))` (or equivalently `qlogis(y)`). Thus, the pseudo $R^2$ is `cor(log(y/(1 - y)), x %*% beta)^2`. – Achim Zeileis Aug 24 '16 at 02:02