R: Display Pearson Chi2 and associated dispersion statistic...
P__disp
R Documentation
Display Pearson Chi2 and associated dispersion statistic
following following use of glm.
Description
Following the glm() function with a grouped binomial or poisson family, or glm.nb(),
P__disp() displays the Pearson Chi2 statistic and related dispersion statistic.
Values of the dispersion greater than 1.0 indicate possible overdispersion; values
under 1.0 indicate possible underdispersion.
Usage
P__disp(x)
Arguments
x
glm object
Format
x
The only argument is the name of the fitted glm or glm.nb function model
Details
P_disp is a post-estimation function, following the use of glm() or glm.nb().
Appropriate with grouped binomial or Poisson glm families.
Value
Pearson Chi2
Pearson Chi2 statistic
Dispersion
Pearson dispersion: Chi2/dof
Note
P__disp must be loaded into memory in order to be effectve. As a function in LOGIT,
it is immediately available to a user.
Author(s)
Joseph M. Hilbe, Arizona State University, and
Jet Propulsion Laboratory, California Institute of technology
References
Hilbe, Joseph M. (2015), Practical Guide to Logistic Regression, Chapman & Hall/CRC.
Hilbe, Joseph M. (2014), Modeling Count Data, Cambridge University Press
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(LOGIT)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/LOGIT/P__disp.Rd_%03d_medium.png", width=480, height=480)
> ### Name: P__disp
> ### Title: Display Pearson Chi2 and associated dispersion statistic
> ### following following use of glm.
> ### Aliases: P__disp
> ### Keywords: models
>
> ### ** Examples
>
> library(MASS)
> library(LOGIT)
> data(titanicgrp)
> class03 <- factor(titanicgrp$class, levels=c("3rd class", "2nd class", "1st class"))
> died <- titanicgrp$cases - titanicgrp$survive
> grptit <- glm( cbind(survive, died) ~ age+sex+class03, family=binomial,
+ data=titanicgrp)
> summary(grptit)
Call:
glm(formula = cbind(survive, died) ~ age + sex + class03, family = binomial,
data = titanicgrp)
Deviance Residuals:
Min 1Q Median 3Q Max
-4.232 -2.365 1.038 3.180 4.362
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) 1.2955 0.2478 5.227 1.72e-07 ***
ageadults -1.0556 0.2427 -4.350 1.36e-05 ***
sexman -2.3695 0.1453 -16.313 < 2e-16 ***
class032nd class 0.7558 0.1753 4.313 1.61e-05 ***
class031st class 1.7664 0.1707 10.347 < 2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 581.40 on 11 degrees of freedom
Residual deviance: 110.84 on 7 degrees of freedom
AIC: 157.77
Number of Fisher Scoring iterations: 5
> P__disp(grptit)
Pearson Chi2 = 100.8828
Dispersion = 14.41183
>
>
>
>
>
> dev.off()
null device
1
>