Learn R Programming

binomTools (version 1.0-1)

Rsq.glm: R-squared measures for binomial GLMs

Description

This function computes the R-squared measures for binomial GLMs proposed by Tjur (2010) "Coefficients of determination in logistic regression models - a new proposal: The coefficient of discrimination".

Usage

## S3 method for class 'glm':
Rsq(object, ...)

## S3 method for class 'Rsq':
print(x, digits = getOption("digits"), ...)

## S3 method for class 'Rsq':
plot(x, which=c("hist", "ecdf", "ROC"), ...)

Arguments

object
a binomial glm object
x
an Rsq object
which
the desired plot: histograms, empirical cumulative distribution functions or ROC (receiver operating characteristic) curve
digits
the desired number of printed digits
...
currently not used

Value

  • Rsq.glm returns an object of class Rsq. The plot and print methods returns the Rsq objects invisibly.

Details

The plot method has the following options [object Object],[object Object],[object Object]

References

Tjur, T. (2009) Coefficients of determination in logistic regression models - a new proposal: The coefficient of discrimination. The American Statistician, 63(4), 366-372.

See Also

A HLtest (Hosmer and Lemeshow test) method exists for Rsq objects.

Examples

Run this code
## Lifted from example(predict.glm):
ldose <- rep(0:5, 2)
numdead <- c(1, 4, 9, 13, 18, 20, 0, 2, 6, 10, 12, 16)
sex <- factor(rep(c("M", "F"), c(6, 6)))
SF <- cbind(numdead, numalive=20-numdead)
budworm.lg <- glm(SF ~ sex*ldose, family=binomial)
## summary(budworm.lg)

(Rsq.budworm <- Rsq(budworm.lg))

plot(Rsq.budworm, "hist") ## or simply 'plot(Rsq.budworm)'
plot(Rsq.budworm, "ecdf")
plot(Rsq.budworm, "ROC")

Run the code above in your browser using DataLab