I have question regarding the mnlogit
package in R which I'll ask on StackOverflow as it's related to a specific language and library, however I won't be offended if someone decides to move it to Cross Validated (it was a hard choice of which StackExchange site was most appropriate).
I'm just trying to make sure I understand how this works, since the documentation isn't too detailed, I see some confusing/conflicting blog entries on this package, and because it's been a couple of years since I've dealt with choice models.
The example usage of mnlogit
is basically as follows:
> require(mnlogit)
> data(Fish)
> 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
> fm <- formula(mode ~ price | income | catch)
> result <- mnlogit(fm, Fish, "alt", ncores = 2)
What I find confusing is mode
and alt
. I would've thought that the dependent variable would be the multinomial choice, which appears to be alt
(beach, boat, charter, or pier).
Instead it's this logical variable, mode
. What's mode
?
To try to clarify my understand I read an R-Bloggers article on the topic. It actually made things more confusing by repeating the Fish
example, but with a preamble describing the dataset in this way:
A data frame containing :
mode - The choice set: beach, pier, boat, and charter price - price for a mode for an individual catch - fish catch rate for a mode for an individual income - monthly income of the individual decision-maker chid - decision maker ID
It describes mode
as if it were alt
then does not mention alt
. Can someone explain this to me?
If mode
really did take on the discrete choice values as described in the R-Bloggers article, then the model formula(mode ~ price | income | catch)
would make sense to me... but mode
is a logical variable, so I am thoroughly confused.