mlogit包R:关于嵌套Logit

时间:2016-07-02 15:34:15

标签: r nested mlogit

在嵌套的logit模型中,您可以在树的每个级别定义回归量。在我在手册和其他示例中阅读的所有示例中,回归量仅针对最后一级进行定义。我将使用一个常见的例子,捕鱼模式。

巢:

Shore = { Beach, Pier} , Boat = { Charter, Private}

假设我有回归量PriceCatchRateIncome。如何使用PriceCatchRate解释最后一级,Income解释第一级。

在R中,我可以这样做:

mlogit(choice~price+catch,nests=list(shore=c("pier","beach"),boat=c("charter","private")))

但我不知道在哪里粘贴变量income

1 个答案:

答案 0 :(得分:0)

您正在使用的示例和问题的答案都在文档中:

## model with charter as the reference level

m <- mlogit(mode ~ price+ catch | income, data = Fish, reflevel = "charter")

## same model with a subset of alternatives : charter, pier, beach

m <- mlogit(mode ~ price+ catch | income, data = Fish,
            alt.subset = c("charter", "pier", "beach"))

## a pure "multinomial model"

summary(mlogit(mode ~ 0 | income, data = Fish))

## which can also be estimated using multinom (package nnet)

library("nnet")
summary(multinom(mode ~ income, data = Fishing))

## a "mixed" model

m <- mlogit(mode ~ price+ catch | income, data = Fish)
summary(m)