Learn R Programming

mhurdle (version 0.1-3)

rsq: R squared and pseudo R squared

Description

This function computes the R squared for multiple hurdle models. The measure is a pseudo coefficient of determination or may be based on the likelihood.

Usage

rsq(object, type = c("coefdet", "lratio"),
            adj = FALSE, r2pos = c("rss", "ess", "cor"))

Arguments

object
an object of class "mhurdle",
type
one of "coefdet" or "lratio" to select a pseudo coefficient of correlation or a Mc Fadden like measure based on the likelihood function,
adj
if TRUE a correction for the degrees of freedom is performed,
r2pos
only for pseudo coefficient of determination, should the positive part of the R squared be computed using the residual sum of squares ("rss"), the explained sum of squares ("ess") or the coefficient of correlation bet

Value

  • a numerical value

References

McFadden D (1974). The Measurement of Urban Travel Demand. Journal of Public Economics, 3, 303-328.

Examples

Run this code
data("Comics", package = "mhurdle")
Comics$incu <- with(Comics, income / cu)
Comics$incum <- with(Comics, incu / mean(incu))
model3 <- mhurdle(comics ~ 0 | log(incum) + I(log(incum)^2) +
                  I(log(incum)^3) + age  + gender + educ +
                  size| 0, Comics, dist = "n", method = 'bfgs')
rsq(model3, type = "lratio")
rsq(model3, type = "coefdet", adj = TRUE, r2pos = "rss")

Run the code above in your browser using DataLab