Modelowanie wyborów w marketingu w 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.1209849 0.0225714 5.3601 8.317e-08 ***
price -0.1086995 0.0072056 -15.0855 < 2.2e-16 ***
...
alpha <- 0.1209849 beta <- -0.1086995v1 <- 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.1289520 0.0240754 5.3562 8.501e-08 ***
price -0.1240263 0.0078032 -15.8942 < 2.2e-16 ***
transmanual -1.2842880 0.0645391 -19.8994 < 2.2e-16 ***
convertyes 0.1329741 0.0599727 2.2172 0.02661 *
...
head(model.matrix(m2))
seat price transmanual convertyes
1 2 35 1 1
2 5 40 0 0
3 5 30 0 0
4 5 35 1 0
5 2 30 1 0
6 4 35 0 0
head(sportscar.df)
resp_id ques alt segment seat trans convert price choice chid
1 1 1 1 basic 2 manual yes 35 0 1
2 1 1 2 basic 5 auto no 40 0 1
3 1 1 3 basic 5 auto no 30 1 1
4 1 2 1 basic 5 manual no 35 1 2
5 1 2 2 basic 2 manual no 30 0 2
6 1 2 3 basic 4 auto no 35 0 2
m2 <- mlogit(choice ~ 0 + seat + price + trans + convert,
data = sportscar)
summary(m2)
...
Coefficients :
Estimate Std. Error z-value Pr(>|z|)
seat 0.1289520 0.0240754 5.3562 8.501e-08 ***
price -0.1240263 0.0078032 -15.8942 < 2.2e-16 ***
transmanual -1.2842880 0.0645391 -19.8994 < 2.2e-16 ***
convertyes 0.1329741 0.0599727 2.2172 0.02661 *
...
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.0325111 0.0740773 -0.4389 0.66075
seat5 0.4544726 0.0727418 6.2478 4.164e-10 ***
transmanual -1.2924905 0.0648593 -19.9276 < 2.2e-16 ***
convertyes 0.1400317 0.0601889 2.3265 0.01999 *
price -0.1249230 0.0078354 -15.9434 < 2.2e-16 ***
coef(m3)
seat4 seat5 transmanual convertyes price
-0.0325111 0.4544726 -1.2924905 0.1400317 -0.1249230
coef(m3) / -coef(m3)[5]
seat4 seat5 transmanual convertyes price
-0.2602492 3.6380231 -10.3463014 1.1209442 -1.0000000
Modelowanie wyborów w marketingu w R