nagelkerkeR2: Nagelkerme method R-square

Description Usage Arguments Value Examples

View source: R/extras.R

Description

Estimate Nagelkerke's R squared from the result of glm(). Evaluate the goodness of fit for logistic regression.

Usage

1

Arguments

x

An object of class 'glm'.

Value

Rsquare Nagelkerke's R squared.

Examples

1
2
3
4
5
6
7
8
9
set.seed(7388)
n <- 300
x <- rnorm(n)
a <- 1
b <- -2
p <- 1/(1+exp(a+b*x))
y <- factor(ifelse(runif(n) < p, 1, 0), levels = 0:1)
mod1 <- glm(y ~ x, family=binomial)
nagelkerkeR2(mod1)

Example output

[1] 0.4966473

sizeMat documentation built on July 8, 2020, 7:27 p.m.