Last data update: 2014.03.03

R: lbwgrp
lbwgrpR Documentation

lbwgrp

Description

grouped format of the lbw data. The observation level data come to us form Hosmer and Lemeshow (2000). Grouping is such that lowbw is the numerator, and cases the denominator of a binomial model, or cases may be an offset to the count variable, lowbw. Birthweights under 2500g classifies a low birthweight baby.

Usage

data(lbwgrp)

Format

A data frame with 6 observations on the following 7 variables.

lowbw

Number of low weight babies per covariate pattern: 12-60

cases

Number of observations with same covariate pattern: 30-165

smoke

1=history of mother smoking; 0=mother nonsmoker

race1

(1/0): Caucasian

race2

(1/0): Black

race3

(1/0): Other

low

low birth weight (not valid variable in grouped format)

Details

lbwgrp is saved as a data frame. Count models: count response=lowbt; offset=log(cases); Binary: binomial numerator= lowbt; binomial denominator=cases

Source

Hosmer, D and S. Lemeshow (2000), Applied Logistic Regression, Wiley

References

Hilbe, Joseph M (2007, 2011), Negative Binomial Regression, Cambridge University Press Hilbe, Joseph M (2009), Logistic Regression Models, Chapman & Hall/CRC

Examples

data(lbwgrp)
glmgp <- glm(lowbw ~ smoke + race2 + race3 + offset(log(cases)), family=poisson, data=lbwgrp)
summary(glmgp)
exp(coef(glmgp))
library(MASS)
glmgnb <- glm.nb(lowbw ~  smoke + race2 + race3, data=lbwgrp)
summary(glmgnb)
exp(coef(glmgnb))

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/lbwgrp.Rd_%03d_medium.png", width=480, height=480)
> ### Name: lbwgrp
> ### Title: lbwgrp
> ### Aliases: lbwgrp
> ### Keywords: datasets
> 
> ### ** Examples
> 
> data(lbwgrp)
> glmgp <- glm(lowbw ~ smoke + race2 + race3 + offset(log(cases)), family=poisson, data=lbwgrp)
> summary(glmgp)

Call:
glm(formula = lowbw ~ smoke + race2 + race3 + offset(log(cases)), 
    family = poisson, data = lbwgrp)

Deviance Residuals: 
       1         2         3         4         5         6  
 1.07530   0.10872  -2.00911  -1.77224  -0.09757   1.16742  

Coefficients:
            Estimate Std. Error z value Pr(>|z|)    
(Intercept)  -1.8690     0.1656 -11.286  < 2e-16 ***
smoke         0.7034     0.1613   4.360 1.30e-05 ***
race2         0.6776     0.2130   3.182  0.00146 ** 
race3         0.7153     0.1788   4.000 6.32e-05 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(Dispersion parameter for poisson family taken to be 1)

    Null deviance: 38.8645  on 5  degrees of freedom
Residual deviance:  9.7179  on 2  degrees of freedom
AIC: 47.725

Number of Fisher Scoring iterations: 4

> exp(coef(glmgp))
(Intercept)       smoke       race2       race3 
  0.1542841   2.0206861   1.9691589   2.0446990 
> library(MASS)
> glmgnb <- glm.nb(lowbw ~  smoke + race2 + race3, data=lbwgrp)
> summary(glmgnb)

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

Deviance Residuals: 
       1         2         3         4         5         6  
 0.95862  -0.05676  -1.42819  -1.50409   0.05507   0.92064  

Coefficients:
            Estimate Std. Error z value Pr(>|z|)    
(Intercept)   3.4497     0.4664   7.397  1.4e-13 ***
smoke         0.1157     0.4701   0.246    0.806    
race2        -0.7074     0.5820  -1.215    0.224    
race3         0.1496     0.5668   0.264    0.792    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

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

    Null deviance: 8.3405  on 5  degrees of freedom
Residual deviance: 6.0748  on 2  degrees of freedom
AIC: 58.848

Number of Fisher Scoring iterations: 1


              Theta:  3.41 
          Std. Err.:  2.10 

 2 x log-likelihood:  -48.848 
> exp(coef(glmgnb))
(Intercept)       smoke       race2       race3 
  31.489383    1.122695    0.492914    1.161381 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>