Valmodellering för marknadsföring i 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 = 2059.32910491, chi2 = 269.32389751
seat price
param 0.113 -0.103
gradient -15.471 107.575
----------------------------------------
iteration 2, step = 1, lnL = 2058.96822672, chi2 = 0.71774347
seat price
param 0.121 -0.109
gradient -0.143 0.886
----------------------------------------
iteration 3, step = 1, lnL = 2058.96820087, chi2 = 5.171e-05
seat price
param 0.121 -0.109
gradient 0.000 0.000
summary(m1)
Call:
mlogit(formula = choice ~ 0 + seat + price, data = sportscar,
print.level = 3, method = "nr")
Frequencies of alternatives:choice
1 2 3
0.331 0.338 0.331
nr method
4 iterations, 0h:0m:0s
g'(-H)^-1g = 5.17E-05
successive function values within tolerance limits
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 ***
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Log-Likelihood: -2059
sportscar.df$chid <- cumsum(sportscar.df$alt == 1)
sportscar <- dfidx(sportscar.df, idx = c("chid", "alt"),
choice = "choice")
Valmodellering för marknadsföring i R