fabric: Numbers of Faults Found in Each of 32 Rolls of Fabric

Description Usage Format Details Examples

Description

Numbers of faults found in each of 32 rolls of fabric produced in a particular factory. Also given is the length of the roll.

Usage

1

Format

A data frame with 32 observations on the following 2 variables.

length

length of roll

faults

number of faults in roll

Details

The book uses this for exercise 5. page 441

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
data(fabric)
str(fabric)
names(fabric)
# Identity link:
with(fabric, plot(faults ~ length))
# log link:
with(fabric, plot(faults ~ length, log="y"))
# Fitting poisson regression models:
mod1 <- glm(faults ~ length-1, data=fabric, family=poisson)
OK <- require(MCMCpack)
if(OK) mod2 <- MCMCpoisson(faults ~ length-1, data=fabric, b0=0, B0=0.0001)
summary(mod1)
confint(mod1)
if(OK) summary(mod2)
# The exercise is to investigate overdispersion ...

Example output

'data.frame':	32 obs. of  2 variables:
 $ length: int  551 651 832 375 715 868 271 630 491 372 ...
 $ faults: int  6 4 17 9 14 8 5 7 7 7 ...
[1] "length" "faults"
Loading required package: MCMCpack
Loading required package: coda
Loading required package: MASS
##
## Markov Chain Monte Carlo Package (MCMCpack)
## Copyright (C) 2003-2017 Andrew D. Martin, Kevin M. Quinn, and Jong Hee Park
##
## Support provided by the U.S. National Science Foundation
## (Grants SES-0350646 and SES-0350613)
##

Call:
glm(formula = faults ~ length - 1, family = poisson, data = fabric)

Deviance Residuals: 
    Min       1Q   Median       3Q      Max  
-3.1289  -0.4759   0.3938   1.2869   4.3445  

Coefficients:
        Estimate Std. Error z value Pr(>|z|)    
length 3.242e-03  8.352e-05   38.81   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(Dispersion parameter for poisson family taken to be 1)

    Null deviance: 839.793  on 32  degrees of freedom
Residual deviance:  80.554  on 31  degrees of freedom
AIC: 205.85

Number of Fisher Scoring iterations: 4

Waiting for profiling to be done...
      2.5 %      97.5 % 
0.003074660 0.003402216 

Iterations = 1001:11000
Thinning interval = 1 
Number of chains = 1 
Sample size per chain = 10000 

1. Empirical mean and standard deviation for each variable,
   plus standard error of the mean:

          Mean             SD       Naive SE Time-series SE 
      0.003242       0.000000       0.000000       0.000000 

2. Quantiles for each variable:

    2.5%      25%      50%      75%    97.5% 
0.003242 0.003242 0.003242 0.003242 0.003242 

BayesDA documentation built on May 29, 2017, 9:08 a.m.