Last data update: 2014.03.03

R: Dataset due to Danaher
danaherR Documentation

Dataset due to Danaher

Description

Dataset due to Danaher; also an analysis ab initio

Usage

data(danaher)

Format

  • danaher is a matrix (of class Oarray) that represents Danaher and Hardie's Table 1

Details

Since bacon is often eaten with eggs, it is reasonable to expect that it is purchased with eggs.

Danaher and Hardie use a dataset obtained from a sample of 548 households over four consecutive store trips. They considered only grocery shopping trips with a total basket value of at least five dollars. For each household, they counted the total number of bacon purchases in their four eligible shopping trips, and the total number of egg purchases for the same trips.

Object danaher is a five-by-five matrix of class Oarray with entry (i,j) indicating the number of shoppers buying bacon on i occasions and eggs on j occasions (note the zero offset). Thus danaher[1,2]=16 indicates that 16 shoppers bought bacon on 1 occasion and eggs on 2 occasions.

References

P. J. Danaher and B. G. S. Hardie 2005. “Bacon with your eggs? Applications of a new bivariate beta-binomial distribution”. The American Statistician, 59(4):282

See Also

optimizer

Examples

data(danaher)
Lindsey_MB(danaher)

# Dataset from table 3 follows; see also the example at Lindsey.Rd
mags <-
c(2463, 35, 44, 14, 16, 7, 262, 20, 2, 2, 0, 0, 0, 2, 17, 2,
0, 2, 0, 0, 3, 8, 0, 0, 1, 0, 0, 4, 8, 0, 1, 1, 0, 0, 3, 3,
0, 0, 0, 0, 0, 1, 52, 2, 1, 0, 2, 0, 22)
dim(mags) <- c(7,7)
mags <- as.Oarray(mags,offset=0)
dimnames(mags) <- 
list(AA=as.character(0:6),Sig=as.character(0:6))  # messy kludge in Lindsey_MB()
summary(Lindsey_MB(mags))

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(MM)
Loading required package: magic
Loading required package: abind
Loading required package: partitions
Loading required package: emulator
Loading required package: mvtnorm
Loading required package: Oarray
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/MM/danaher.Rd_%03d_medium.png", width=480, height=480)
> ### Name: danaher
> ### Title: Dataset due to Danaher
> ### Aliases: danaher
> ### Keywords: datasets
> 
> ### ** Examples
> 
> data(danaher)
> Lindsey_MB(danaher)

Call:  glm(formula = d ~ (.), family = poisson, data = x, offset = Off)

Coefficients:
   (Intercept)           bacon            eggs  `bacon:nbacon`    `eggs:neggs`  
        5.5117         -1.6528         -1.0487         -0.5149         -0.3555  
  `bacon:eggs`  
        0.3006  

Degrees of Freedom: 24 Total (i.e. Null);  19 Residual
Null Deviance:	    3046 
Residual Deviance: 18.67 	AIC: 108.3
> 
> # Dataset from table 3 follows; see also the example at Lindsey.Rd
> mags <-
+ c(2463, 35, 44, 14, 16, 7, 262, 20, 2, 2, 0, 0, 0, 2, 17, 2,
+ 0, 2, 0, 0, 3, 8, 0, 0, 1, 0, 0, 4, 8, 0, 1, 1, 0, 0, 3, 3,
+ 0, 0, 0, 0, 0, 1, 52, 2, 1, 0, 2, 0, 22)
> dim(mags) <- c(7,7)
> mags <- as.Oarray(mags,offset=0)
> dimnames(mags) <- 
+ list(AA=as.character(0:6),Sig=as.character(0:6))  # messy kludge in Lindsey_MB()
> summary(Lindsey_MB(mags))

Call:
glm(formula = d ~ (.), family = poisson, data = x, offset = Off)

Deviance Residuals: 
    Min       1Q   Median       3Q      Max  
-8.3202  -0.6458  -0.2023   2.0970   6.8610  

Coefficients:
             Estimate Std. Error z value Pr(>|z|)    
(Intercept)  7.782592   0.020279 383.770  < 2e-16 ***
AA          -0.373631   0.010613 -35.207  < 2e-16 ***
Sig         -0.633903   0.021891 -28.958  < 2e-16 ***
`AA:nAA`    -0.900871   0.014309 -62.958  < 2e-16 ***
`Sig:nSig`  -0.935319   0.018848 -49.625  < 2e-16 ***
`AA:Sig`     0.040440   0.006655   6.077 1.22e-09 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

(Dispersion parameter for poisson family taken to be 1)

    Null deviance: 43882.55  on 48  degrees of freedom
Residual deviance:   345.22  on 43  degrees of freedom
AIC: 466.88

Number of Fisher Scoring iterations: 6

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