logregR2: Logistic regression model statistics

Description Usage Arguments Value Examples

View source: R/logregR2.r

Description

Logistic regression model statistics

Usage

1
logregR2(model, digits = 3)

Arguments

model

An estimated logistic regression model

digits

Number of digits to be displayed after decimal points

Value

Returns list of statistics about model (a "LogRegR2" class object)

Examples

1
2
3
4
5
6
7
8
   library(poliscidata)
   obama_state_model <- glm(obama_win12 ~ secularism + gunlaw_rank, data=states, family=binomial)
   summary(obama_state_model)
   logregR2(obama_state_model)
   
   obama_vote_model <- svyglm(obama_vote ~ ft_dem, design=nesD, family="quasibinomial")
   summary(obama_vote_model)
   logregR2(obama_vote_model)

Example output

Call:
glm(formula = obama_win12 ~ secularism + gunlaw_rank, family = binomial, 
    data = states)

Deviance Residuals: 
     Min        1Q    Median        3Q       Max  
-1.50562  -0.20026   0.03132   0.21780   2.42177  

Coefficients:
            Estimate Std. Error z value Pr(>|z|)   
(Intercept)  1.21467    1.80898   0.671  0.50192   
secularism   0.04126    0.01513   2.728  0.00638 **
gunlaw_rank -0.20996    0.06853  -3.064  0.00219 **
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(Dispersion parameter for binomial family taken to be 1)

    Null deviance: 69.235  on 49  degrees of freedom
Residual deviance: 20.210  on 47  degrees of freedom
AIC: 26.21

Number of Fisher Scoring iterations: 7

Chi2                 49.024 
Df                   2 
Sig.                 <.001 
Cox and Snell Index  0.625 
Nagelkerke Index     0.834 
McFadden's R2        0.708 

Call:
svyglm(formula = ...)

Survey design:
survey::svydesign(id = ~1, data = nes, weights = ~wt)

Coefficients:
             Estimate Std. Error t value Pr(>|t|)    
(Intercept) -4.665066   0.290913  -16.04   <2e-16 ***
ft_dem       0.093648   0.005256   17.82   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(Dispersion parameter for quasibinomial family taken to be 1.553351)

Number of Fisher Scoring iterations: 6

Chi2                 2698.382 
Df                   1 
Sig.                 <.001 
Cox and Snell Index  0.476 
Nagelkerke Index     0.645 
McFadden's R2        0.483 

poliscidata documentation built on July 8, 2020, 6:23 p.m.