Choice Modeling for Marketing in R
Elea McDonnel Feit
Assistant Professor of Marketing, Drexel University
m1 <- mlogit(choice ~ 0 + seat + price, data=sportscar)
summary(m1)
...
Coefficients :
Estimate Std. Error z-value Pr(>|z|)
seat 0.1143487 0.0234195 4.8826 1.047e-06 ***
price -0.1687046 0.0079224 -21.2947 < 2.2e-16 ***
...
alpha <- 0.1143487 beta <- -0.1687046
v1 <- alpha * seat1 + beta * price1 v2 <- alpha * seat2 + beta * price2 v3 <- alpha * seat3 + beta * price3 p1 <- exp(v1) / ( exp(v1) + exp(v2) + exp(v3) ) p2 <- exp(v2) / ( exp(v1) + exp(v2) + exp(v3) ) p3 <- exp(v3) / ( exp(v1) + exp(v2) + exp(v3) )
m2 <- mlogit(choice ~ 0 + seat + price + trans + convert,
data = sportscar)
summary(m2)
...
Coefficients :
Estimate Std. Error z-value Pr(>|z|)
seat 0.1201748 0.0248393 4.8381 1.311e-06 ***
price -0.1895992 0.0086355 -21.9559 < 2.2e-16 ***
transmanual -1.2122404 0.0662971 -18.2850 < 2.2e-16 ***
convertyes 0.1932630 0.0618676 3.1238 0.001785 **
...
head(model.matrix(m2))
seat price transmanual convertyes
1.1 2 35 1 1
1.2 5 40 0 0
1.3 5 30 0 0
2.1 5 35 1 0
2.2 2 30 1 0
2.3 4 35 0 0
head(sportscar)
resp_id ques alt segment seat trans convert price choice
1.1 1 1 1 basic 2 manual yes 35 FALSE
1.2 1 1 2 basic 5 auto no 40 FALSE
1.3 1 1 3 basic 5 auto no 30 TRUE
2.1 1 2 1 basic 5 manual no 35 FALSE
2.2 1 2 2 basic 2 manual no 30 TRUE
2.3 1 2 3 basic 4 auto no 35 FALSE
m2 <- mlogit(choice ~ 0 + seat + price + trans + convert,
data = sportscar)
summary(m2)
...
Coefficients :
Estimate Std. Error z-value Pr(>|z|)
seat 0.1201748 0.0248393 4.8381 1.311e-06 ***
price -0.1895992 0.0086355 -21.9559 < 2.2e-16 ***
transmanual -1.2122404 0.0662971 -18.2850 < 2.2e-16 ***
convertyes 0.1932630 0.0618676 3.1238 0.001785 **
...
sportscar$seat <- as.factor(sportscar$seat)
m3 <- mlogit(choice ~ 0 + seat + trans + convert + price,
data = sportscar)
summary(m3)
Coefficients :
Estimate Std. Error z-value Pr(>|z|)
seat4 -0.0193861 0.0759029 -0.2554 0.798409
seat5 0.4245449 0.0752808 5.6395 1.706e-08 ***
transmanual -1.2178833 0.0665276 -18.3064 < 2.2e-16 ***
convertyes 0.2008115 0.0620854 3.2344 0.001219 **
price -0.1907023 0.0086739 -21.9859 < 2.2e-16 ***
coef(m3)
seat4 seat5 transmanual convertyes price
-0.01938614 0.42454491 -1.21788327 0.20081149 -0.19070229
coef(m3) / -coef(m3)[5]
seat4 seat5 transmanual convertyes price
-0.1016566 2.2262181 -6.3863063 1.0530103 -1.0000000
Choice Modeling for Marketing in R