Description Usage Arguments Value Examples
This functions computes several types of Pseudo-R-Squares from one or several logistic regression models obtained from glm
, polr
, or multinom
.
1 |
... |
one or several objects of type |
type |
character, one or several out of "McFadden", "Nagelkerke", "CoxSnell". |
digits |
how many digits should be printed? |
A table with all Pseudo-R-Squares.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # Simulate data
set.seed(666)
x1 = rnorm(1000) # some continuous variables
x2 = rnorm(1000)
z = 1 + 2*x1 + 3*x2 # linear combination with a bias
pr = 1/(1+exp(-z)) # pass through an inv-logit function
y = rbinom(1000,1,pr) # bernoulli response variable
d = data.frame(y=y,x1=x1,x2=x2)
# Estimate models
m1 <- glm(y~x1, data=d, family="binomial")
m2 <- glm(y~x1+x2, data=d, family="binomial")
# Run function
pseudo_r2(m1, m2, digits = 3)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.