Description Usage Arguments Details Value Author(s) References See Also Examples
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".
1 2 3 4 5 6 7 8 |
object |
a binomial |
x |
an |
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 |
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
Rsq.glm
returns an object of class Rsq
. The plot
and print
methods returns the Rsq
objects invisibly.
Rune Haubo B Christensen
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.
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")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.