Learn R Programming

mhurdle (version 0.1-0)

r.squared: R squared and pseudo R squared

Description

This function computes the R squared for multiple hurdle models. The measure is linear or may be based on the likelihood and may measure the goodness of fit for the zero part, the positive part of the model or the whole model.

Usage

r.squared(object, which = c("all", "zero", "positive"),
          type = c("regression", "mcfadden"), dfcor = FALSE,
          r2pos = c("rss", "ess", "cor"))

Arguments

object
an object of class "mhurdle",
which
which part of the model the goodness of fit has to be computed, one of "all" (the whole model), "zero" (null versus positive values), "positive" (values for the truncated sample of positive values),
type
one of "regression" or "mcfadden" to select a linear measure of the R squared or a Mc Fadden like measure based on the likelihood function,
dfcor
if TRUE a correction for the degrees of freedom is performed,
r2pos
only for linear R squared, 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 between the fitted val

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("tobin", package = "survival")
dhi <- mhurdle(durable ~ age + quant | age + quant | 0, tobin, 
            dist = "n", corr = FALSE)
r.squared(dhi, type = "mcfadden")
r.squared(dhi, "zero")
r.squared(dhi, "positive", dfcor = TRUE, r2pos = "ess")

Run the code above in your browser using DataLab