Last data update: 2014.03.03

R: Fit Statistics for generalized linear models
modelfitR Documentation

Fit Statistics for generalized linear models

Description

modelfit is used following a glm() or glm.nb() model to produce a list of model fit statistics.

Usage

modelfit(x)

Arguments

x

the only argument is the name of the fitted glm or glm.nb function model

Details

modelfit is to be used as a post-estimation function, following the use of glm() or glm.nb().

Value

obs

number of model observatiions

aic

AIC statistic

xvars

number of model predictors

rdof

residial degrees of freedom

aic_n

AIC, 'aic'/'obs'

ll

log-likelihood

bic_r

BIC - Raftery parameterization

bic_l

BIC - log-likelihood Standard definition (Stata)

bic_qh

Hannan-Quinn IC statistic (Limdep)

Note

modelfit.r must be loaded into memory in order to be effectve. Users may past modelfit.r into script editor to run, as well as load it.

Author(s)

Joseph M. Hilbe, Arizona State University, and Jet Propulsion Laboratory, California Institute of technology

References

Hilbe, J.M. (2011), Negative Binomial Regression, second edition, Cambridge University Press.

Hilbe, J.M. (2009), Logistic Regression Models, Chapman Hall/CRC

See Also

glm, glm.nb

Examples

## Hilbe (2011), Table 9.17
library(MASS)
data(lbwgrp)
nb9_3 <- glm.nb(lowbw ~ smoke + race2 + race3 + offset(log(cases)), data=lbwgrp)
summary(nb9_3)
exp(coef(nb9_3))
modelfit(nb9_3) 

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(COUNT)
Loading required package: msme
Loading required package: MASS
Loading required package: lattice
Loading required package: sandwich
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/COUNT/modelfit.Rd_%03d_medium.png", width=480, height=480)
> ### Name: modelfit
> ### Title: Fit Statistics for generalized linear models
> ### Aliases: modelfit
> ### Keywords: models
> 
> ### ** Examples
> 
> ## Hilbe (2011), Table 9.17
> library(MASS)
> data(lbwgrp)
> nb9_3 <- glm.nb(lowbw ~ smoke + race2 + race3 + offset(log(cases)), data=lbwgrp)
> summary(nb9_3)

Call:
glm.nb(formula = lowbw ~ smoke + race2 + race3 + offset(log(cases)), 
    data = lbwgrp, init.theta = 40.75768937, link = log)

Deviance Residuals: 
       1         2         3         4         5         6  
 0.92607   0.10367  -1.50503  -1.32012  -0.09634   1.00627  

Coefficients:
            Estimate Std. Error z value Pr(>|z|)    
(Intercept)  -1.9232     0.2141  -8.981  < 2e-16 ***
smoke         0.7109     0.2098   3.389 0.000702 ***
race2         0.7286     0.2678   2.721 0.006505 ** 
race3         0.7246     0.2416   2.999 0.002706 ** 
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(Dispersion parameter for Negative Binomial(40.7577) family taken to be 1)

    Null deviance: 23.660  on 5  degrees of freedom
Residual deviance:  5.898  on 2  degrees of freedom
AIC: 48.945

Number of Fisher Scoring iterations: 1


              Theta:  40.8 
          Std. Err.:  59.8 

 2 x log-likelihood:  -38.945 
> exp(coef(nb9_3))
(Intercept)       smoke       race2       race3 
  0.1461455   2.0358763   2.0722140   2.0638248 
> modelfit(nb9_3) 
$AIC
[1] 48.94485

$AICn
[1] 8.157474

$BIC
[1] 48.11188

$BICqh
[1] 8.672534

> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>