Choice Modeling for Marketing in R
Elea McDonnell Feit
Assistant Professor of Marketing, Drexel University
v1 <- alpha * 4 + beta * 100
v2 <- alpha * 5 + beta * 150
v3 <- alpha * 2 + beta * 175
u1 <- v1 + error1
u2 <- v2 + error2
u3 <- v3 + error3
choice <- which.max(c(u1, u2, u3))
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) )
m1 <- mlogit(choice ~ 0 + seat + price, data = sportscar, print.level = 3)
Initial value of the function : 2197.22457733622
iteration 1, step = 1, lnL = 1918.11271719, chi2 = 534.02624615
seat price
param 0.100 -0.151
gradient -24.028 296.443
----------------------------------------
iteration 2, step = 1, lnL = 1915.29601553, chi2 = 5.51592264
seat price
param 0.114 -0.168
gradient -0.846 9.422
----------------------------------------
iteration 3, step = 1, lnL = 1915.29299604, chi2 = 0.00603424
seat price
param 0.114 -0.169
gradient -0.001 0.011
summary(m1)
Call:
mlogit(formula = choice ~ 0 + seat + price, data = sportscar,
print.level = 3, method = "nr")
Frequencies of alternatives:
1 2 3
0.328 0.327 0.345
nr method
4 iterations, 0h:0m:0s
g'(-H)^-1g = 0.00603
successive function values within tolerance limits
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 ***
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Log-Likelihood: -1915.3
sportscar <- mlogit.data(sportscar.df, shape = "long",
choice = "choice",
varying = 5:8, alt.var = "alt")
Choice Modeling for Marketing in R