Calculates Ferrari's and Cribari-Neto's pseudo R2 (for beta-regression models).
References
Ferrari, S., and Cribari-Neto, F. (2004). Beta Regression for Modelling Rates and Proportions. Journal of Applied Statistics, 31(7), 799–815. doi:10.1080/0266476042000214501
Examples
data("GasolineYield", package = "betareg")
model <- betareg::betareg(yield ~ batch + temp, data = GasolineYield)
#> Warning: NaNs produced
#> Error in while (testhalf & stepFactor < 11) { fit <- fitfun(par, deriv = 2L) scores <- gradfun(par, fit = fit) InfoInv <- try(hessfun(par, fit = fit, inverse = TRUE)) if (failedInv <- inherits(InfoInv, "try-error")) { warning("failed to invert the information matrix: iteration stopped prematurely") break } bias <- if (type == "BR") biasfun(par, fit = fit, vcov = InfoInv)$bias else 0 par <- par + 2^(-stepFactor) * (step <- InfoInv %*% scores - bias) stepFactor <- stepFactor + 1 testhalf <- drop(crossprod(stepPrev) < crossprod(step))}: missing value where TRUE/FALSE needed
r2_ferrari(model)
#> # R2 for Generalized Linear Regression
#> Ferrari's R2: 0.704
