BBBClub: Bookbinder's Book Club

Description Usage Format Details Source References Examples

Description

Marketing case study about a (fictitious) American book club to whose customers a book about “The Art History of Florence” was advertised.

Usage

1
data("BBBClub")

Format

A data frame containing 1,300 observations on 11 variables.

choice

factor. Did the customer buy the advertised book?

gender

factor indicating gender.

amount

total amount of money spent at the BBB Club.

freq

number of books purchased at the BBB Club.

last

number of months since the last purchase.

first

number of months since the first purchase.

child

number of children's books purchased.

youth

number of youth books purchased.

cook

number of cookbooks purchased.

diy

number of do-it-yourself books purchased.

art

number of art books purchased.

Details

The data is a marketing case study about a (fictitious) American book club. taken from the Marketing Engineering textbook of Lilien and Rangaswamy (2004). In this case study, a brochure of the book “The Art History of Florence” was sent to 20,000 customers and 1,806 of which bought the book. A subsample of 1,300 customers is provided in BBBClub for building a predictive model for choice.

The use of a cost matrix is suggested for this dataset. Classifying a customer that purchased the book as a non-buyer is worse (cost = 5), than it is to classify a custumer that did not purchase the book as a buyer (cost = 1).

Source

Complements to Lilien and Rangaswamy (2004).

References

Lilien GL, Rangaswamy A (2004). Marketing Engineering: Computer-Assisted Marketing Analysis and Planning, 2nd edition. Victoria, BC: Trafford Publishing.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
## Not run: 
## data, packages, random seed
data("BBBClub", package = "evtree")
library("rpart")
suppressWarnings(RNGversion("3.5.0"))
set.seed(1090)

## learn trees
ev <- evtree(choice ~ ., data = BBBClub, minbucket = 10, maxdepth = 2)
rp <- as.party(rpart(choice ~ ., data = BBBClub, minbucket = 10, model = TRUE))
ct <- ctree(choice ~ ., data = BBBClub, minbucket = 10, mincrit = 0.99)

## visualization
plot(ev)
plot(rp)
plot(ct)

## accuracy: misclassification rate
mc <- function(obj) 1 - mean(predict(obj) == BBBClub$choice)
c("evtree" = mc(ev), "rpart" = mc(rp), "ctree" = mc(ct))

## complexity: number of terminal nodes
c("evtree" = width(ev), "rpart" = width(rp), "ctree" = width(ct))

## compare structure of predictions
ftable(tab <- table(evtree = predict(ev), rpart  = predict(rp),
  ctree  = predict(ct), observed = BBBClub$choice))

## compare customer predictions only (absolute, proportion correct)
sapply(c("evtree", "rpart", "ctree"), function(nam) {
  mt <- margin.table(tab, c(match(nam, names(dimnames(tab))), 4))
  c(abs = as.vector(rowSums(mt))[2],
    rel = round(100 * prop.table(mt, 1)[2, 2], digits = 3))
})

## End(Not run)

Example output

Loading required package: partykit
Loading required package: grid
Loading required package: libcoin
Loading required package: mvtnorm
   evtree     rpart     ctree 
0.2430769 0.2384615 0.2476923 
evtree  rpart  ctree 
     4      5      8 
                   observed  no yes
evtree rpart ctree                 
no     no    no             799 223
             yes             38  24
       yes   no               0   0
             yes             12  18
yes    no    no               0   0
             yes              0   0
       yes   no              21  19
             yes             30 116
     evtree   rpart   ctree
abs 186.000 216.000 238.000
rel  72.581  70.833  66.387

evtree documentation built on May 26, 2019, 3:01 p.m.