关于钓鱼模式的选择
收集了有关钓鱼模式选择的横截面数据,共有1182个观测值,6个变量,其中钓鱼模式(mode)有四种方式,即beach、pier、boat和charter。price.(表示每个人选择每种模式所付出的成本;)catch.(表示每个人选择每种模式后抓到鱼的概率;)income月收入。现在以钓鱼模式(mode)为因变量,四种选项之间是没有顺序大小的,该如何研究其他因素对钓鱼模式选择的影响?
library(mlogit)
data("Fishing", package = "mlogit")
head(Fishing)
## mode price.beach price.pier price.boat price.charter catch.beach
## 1 charter 157.930 157.930 157.930 182.930 0.0678
## 2 charter 15.114 15.114 10.534 34.534 0.1049
## 3 boat 161.874 161.874 24.334 59.334 0.5333
## 4 pier 15.134 15.134 55.930 84.930 0.0678
## 5 boat 106.930 106.930 41.514 71.014 0.0678
## 6 charter 192.474 192.474 28.934 63.934 0.5333
## catch.pier catch.boat catch.charter income
## 1 0.0503 0.2601 0.5391 7083.332
## 2 0.0451 0.1574 0.4671 1250.000
## 3 0.4522 0.2413 1.0266 3750.000
## 4 0.0789 0.1643 0.5391 2083.333
## 5 0.0503 0.1082 0.3240 4583.332
## 6 0.4522 0.1665 0.3975 4583.332
Fish <- mlogit.data(Fishing, varying = c(2:9), shape = "wide", choice = "mode")
head(Fish)
## mode income alt price catch chid
## 1.beach FALSE 7083.332 beach 157.930 0.0678 1
## 1.boat FALSE 7083.332 boat 157.930 0.2601 1
## 1.charter TRUE 7083.332 charter 182.930 0.5391 1
## 1.pier FALSE 7083.332 pier 157.930 0.0503 1
## 2.beach FALSE 1250.000 beach 15.114 0.1049 2
## 2.boat FALSE 1250.000 boat 10.534 0.1574 2
## Cameron and Trivedi's Microeconometrics p.493 There are two
## alternative specific variables : price and catch one individual
## specific variable (income) and four fishing mode : beach, pier, boat,
## charter
data("Fishing", package = "mlogit")
Fish <- mlogit.data(Fishing, varying = c(2:9), shape = "wide", choice = "mode")
## a pure "conditional" model
summary(mlogit(mode ~ price + catch, data = Fish))
##
## Call:
## mlogit(formula = mode ~ price + catch, data = Fish, method = "nr",
## print.level = 0)
##
## Frequencies of alternatives:
## beach boat charter pier
## 0.11337 0.35364 0.38240 0.15059
##
## nr method
## 7 iterations, 0h:0m:0s
## g'(-H)^-1g = 6.22E-06
## successive function values within tolerance limits
##
## Coefficients :
## Estimate Std. Error t-value Pr(>|t|)
## boat:(intercept) 0.8713749 0.1140428 7.6408 2.154e-14 ***
## charter:(intercept) 1.4988884 0.1329328 11.2755 < 2.2e-16 ***
## pier:(intercept) 0.3070552 0.1145738 2.6800 0.0073627 **
## price -0.0247896 0.0017044 -14.5444 < 2.2e-16 ***
## catch 0.3771689 0.1099707 3.4297 0.0006042 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Log-Likelihood: -1230.8
## McFadden R^2: 0.17823
## Likelihood ratio test : chisq = 533.88 (p.value = < 2.22e-16)
## a pure "multinomial model"
summary(mlogit(mode ~ 0 | income, data = Fish))
##
## Call:
## mlogit(formula = mode ~ 0 | income, data = Fish, method = "nr",
## print.level = 0)
##
## Frequencies of alternatives:
## beach boat charter pier
## 0.11337 0.35364 0.38240 0.15059
##
## nr method
## 4 iterations, 0h:0m:0s
## g'(-H)^-1g = 8.32E-07
## gradient close to zero
##
## Coefficients :
## Estimate Std. Error t-value Pr(>|t|)
## boat:(intercept) 7.3892e-01 1.9673e-01 3.7560 0.0001727 ***
## charter:(intercept) 1.3413e+00 1.9452e-01 6.8955 5.367e-12 ***
## pier:(intercept) 8.1415e-01 2.2863e-01 3.5610 0.0003695 ***
## boat:income 9.1906e-05 4.0664e-05 2.2602 0.0238116 *
## charter:income -3.1640e-05 4.1846e-05 -0.7561 0.4495908
## pier:income -1.4340e-04 5.3288e-05 -2.6911 0.0071223 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Log-Likelihood: -1477.2
## McFadden R^2: 0.013736
## Likelihood ratio test : chisq = 41.145 (p.value = 6.0931e-09)
## which can also be estimated using multinom (package nnet)
library("nnet")
summary(multinom(mode ~ income, data = Fishing))
## # weights: 12 (6 variable)
## initial value 1638.599935
## iter 10 value 1477.150646
## final value 1477.150569
## converged
## Call:
## multinom(formula = mode ~ income, data = Fishing)
##
## Coefficients:
## (Intercept) income
## pier 0.8141506 -1.434028e-04
## boat 0.7389178 9.190824e-05
## charter 1.3412901 -3.163844e-05
##
## Std. Errors:
## (Intercept) income
## pier 5.816490e-09 2.668383e-05
## boat 3.209473e-09 2.057825e-05
## charter 3.921689e-09 2.116425e-05
##
## Residual Deviance: 2954.301
## AIC: 2966.301
## a "mixed" model
m <- mlogit(mode ~ price+ catch | income, data = Fish)
summary(m)
##
## Call:
## mlogit(formula = mode ~ price + catch | income, data = Fish,
## method = "nr", print.level = 0)
##
## Frequencies of alternatives:
## beach boat charter pier
## 0.11337 0.35364 0.38240 0.15059
##
## nr method
## 7 iterations, 0h:0m:0s
## g'(-H)^-1g = 1.37E-05
## successive function values within tolerance limits
##
## Coefficients :
## Estimate Std. Error t-value Pr(>|t|)
## boat:(intercept) 5.2728e-01 2.2279e-01 2.3667 0.0179485 *
## charter:(intercept) 1.6944e+00 2.2405e-01 7.5624 3.952e-14 ***
## pier:(intercept) 7.7796e-01 2.2049e-01 3.5283 0.0004183 ***
## price -2.5117e-02 1.7317e-03 -14.5042 < 2.2e-16 ***
## catch 3.5778e-01 1.0977e-01 3.2593 0.0011170 **
## boat:income 8.9440e-05 5.0067e-05 1.7864 0.0740345 .
## charter:income -3.3292e-05 5.0341e-05 -0.6613 0.5084031
## pier:income -1.2758e-04 5.0640e-05 -2.5193 0.0117582 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Log-Likelihood: -1215.1
## McFadden R^2: 0.18868
## Likelihood ratio test : chisq = 565.17 (p.value = < 2.22e-16)
## same model with charter as the reference level
m <- mlogit(mode ~ price+ catch | income, data = Fish, reflevel = "charter")
summary(m)
##
## Call:
## mlogit(formula = mode ~ price + catch | income, data = Fish,
## reflevel = "charter", method = "nr", print.level = 0)
##
## Frequencies of alternatives:
## charter beach boat pier
## 0.38240 0.11337 0.35364 0.15059
##
## nr method
## 7 iterations, 0h:0m:0s
## g'(-H)^-1g = 1.37E-05
## successive function values within tolerance limits
##
## Coefficients :
## Estimate Std. Error t-value Pr(>|t|)
## beach:(intercept) -1.6944e+00 2.2405e-01 -7.5624 3.952e-14 ***
## boat:(intercept) -1.1671e+00 1.5905e-01 -7.3380 2.169e-13 ***
## pier:(intercept) -9.1641e-01 2.0726e-01 -4.4214 9.805e-06 ***
## price -2.5117e-02 1.7317e-03 -14.5042 < 2.2e-16 ***
## catch 3.5778e-01 1.0977e-01 3.2593 0.001117 **
## beach:income 3.3292e-05 5.0341e-05 0.6613 0.508403
## boat:income 1.2273e-04 2.8631e-05 4.2867 1.813e-05 ***
## pier:income -9.4285e-05 5.0060e-05 -1.8834 0.059640 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Log-Likelihood: -1215.1
## McFadden R^2: 0.18868
## Likelihood ratio test : chisq = 565.17 (p.value = < 2.22e-16)
## same model with a subset of alternatives : charter, pier, beach
m <- mlogit(mode ~ price+ catch | income, data = Fish,
alt.subset = c("charter", "pier", "beach"))
summary(m)
##
## Call:
## mlogit(formula = mode ~ price + catch | income, data = Fish,
## alt.subset = c("charter", "pier", "beach"), method = "nr",
## print.level = 0)
##
## Frequencies of alternatives:
## beach charter pier
## 0.17539 0.59162 0.23298
##
## nr method
## 6 iterations, 0h:0m:0s
## g'(-H)^-1g = 1.89E-07
## gradient close to zero
##
## Coefficients :
## Estimate Std. Error t-value Pr(>|t|)
## charter:(intercept) 1.4925e+00 2.3803e-01 6.2703 3.603e-10 ***
## pier:(intercept) 8.0693e-01 2.1668e-01 3.7241 0.000196 ***
## price -2.8202e-02 2.2784e-03 -12.3781 < 2.2e-16 ***
## catch 1.2167e+00 2.3543e-01 5.1682 2.364e-07 ***
## charter:income 2.0700e-06 5.4114e-05 0.0383 0.969487
## pier:income -1.2224e-04 4.9343e-05 -2.4773 0.013239 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Log-Likelihood: -506.39
## McFadden R^2: 0.30613
## Likelihood ratio test : chisq = 446.84 (p.value = < 2.22e-16)