# Rsq.glm: R-squared measures for binomial GLMs In binomTools: Performing diagnostics on binomial regression models

## 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

 ```1 2 3 4 5 6 7 8``` ```## 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

## Details

The plot method has the following options

`"hist"`

Two histograms with ten bins of the fitted probabilities are plottet on top of each other; the upper one for `y = 0` and the lower one for `y = 1`.

`"ecdf"`

Two ecdf curves; one for `y = 0` and one for `y = 1`

`"ROC"`

The (empirical) ROC curve

## Value

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

## Author(s)

Rune Haubo B Christensen

## 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.

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

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13``` ```## 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") ```

### Example output

```R-square measures and the coefficient of discrimination, 'D':

R2mod     R2res    R2cor         D
0.4300889 0.4151594 0.415289 0.4226242

Number of binomial observations:  12
Number of binary observation:  240
Average group size:  20
```

binomTools documentation built on May 29, 2017, 10:12 p.m.