Questions tagged [mlogit]

mlogit is an R package for estimating models from the logit family

mlogit is an R package which is useful for the estimation for several models of the logit family, e.g.

  • Multinomial logit models
  • Nested logit models
  • Mixed logit models
  • Multinomial probit

If you apply the mlogit package the data has to be reshaped. For running a multinomial regression without reshaping the data you can use the multinom function from the nnet package.

For an overview of functions have a look into the Package vignette.

Tutorials:

74 questions
7
votes
1 answer

R gives me the error "contrasts can be applied only to factors with 2 or more levels" running an mlogit model, but all my factors have 2 levels

I have a set of results from a choice experiment that I am trying to analyse using the mlogit function in R. My data set is shown below, where each STR value represents the three choices in a single choice experiment, 'CHOICE' is a binary variable…
6
votes
2 answers

Analysing rank-ordered data using mlogit

I am trying to analyse rank-ordered data using a logit model as described here (more specifically the model in 5.1). Right now I am not interested in the effect of any covariates but only want to asses the item specific differences by looking at the…
jludewig
  • 203
  • 1
  • 4
5
votes
2 answers

R latent class multinomial logit model

I am using the flexmix package to estimate latent class multinomial logit models in R. In choice theory, there can be variables associated with the alternative (generic) or that vary with the agent (alternative-specific). The nnet package that…
gregmacfarlane
  • 3,242
  • 21
  • 34
5
votes
1 answer

Random effects for a mixed multinomial logistic regression in R?

I have a dataset in which individuals, each belonging to a particular group, repeatedly chose between multiple discrete outcomes. Something akin to: subID group choice 1 Red A 1 Red B 2 Blue B 2 Blue B 2 …
5
votes
1 answer

Binomial Regression "logit" vs "cloglog"

I am using a binomial regression with a categorical factor with 9 levels (named 'treat.group') and sample sizes in each group from 1-8. 1 treatment group has all positive cases (i.e., 1's) - and this creates a estimation problem with the "standard"…
Ella Lunny
  • 53
  • 1
  • 5
5
votes
2 answers

mlogit package fails to recover synthetic mixed logit model

I am generating data from the following synthetic mixed effects model for the utility of agent $h$ choosing transportation mode $j$: $U_{hj} = \beta_{\text{price}} X_{h,\text{price}_j} + \beta_{\text{time}} X_{h,\text{time}_j} + \gamma_h…
khoda
  • 331
  • 2
  • 9
5
votes
1 answer

mlogit. Negative value for sd

I fit a mixed logit using mlogit package, but I get negative values for standard deviation. Any idea why I am getting negative values and how this is interpreted? library(mlogit) #data code=c( "obs4694", "obs4681", "obs1362", "obs3372", "obs1001",…
Milad
  • 175
  • 6
5
votes
2 answers

How do I do a conjoint analysis in R? I don't think the conjoint package is appropriate

We have conducted a conjoint survey of people's preferences when shopping for salmon. We have defined our salmon products in terms of "price" (20p steps from £3.60 to £5), "eco-certification" (none, green statement and certified) and "Brand" (high,…
4
votes
1 answer

How to add Indivivual Specific Variables for unlabelled alternative (using interactions) using mlogit with R?

I’m using DCE with unlabelled alternatives, 9 choice set with 3 alternative each (2 option and Optout alternative), described with 4 attributes. I've started with a conditional logit (with only alternative specific…
4
votes
1 answer

Model relation between two rank variables where ranks are nested within subjects in one variable

I have elicited 10 attributes from $N$ subjects. Each subject rank ordered his own 10 attributes from the most to the least important one. I am interested in the relation between the order of elicitation (i.e. was it the 1st, 2nd, etc. elicited…
Mark Heckmann
  • 261
  • 1
  • 11
4
votes
1 answer

Multinomial logit: mlogit vs statsmodels

I am doing a comparison between mlogit in R and statsmodels in python and have had trouble getting them to produce the same result. I'm wondering if the difference is a result of libraries or I am specifying something incorrectly. Any help would be…
Brian Huey
  • 151
  • 1
  • 4
4
votes
0 answers

Income and price elasticity for multinomial logit/probit and alternative-specific conditional logit/multinomial probit in Stata?

I have a question about estimating income/price elasticity of demand for multinomial logit/probit models in Stata. Lets say I fit a discrete choice model where the outcome is product chosen (4 alternatives) and I have variables at the individual…
Marquis de Carabas
  • 1,667
  • 19
  • 31
3
votes
0 answers

Error impossible to coerce the choice variable to a logical

My data.frame looks like this: ID Set Choice Apple Microsoft IBM Google Intel HewlettPackard Sony Dell Yahoo Nokia 1 1 1 FALSE 1 0 0 0 0 0 0 0 0 0 2 1 1 FALSE 0 1 0 0 …
3
votes
1 answer

Rank-ordered data - dealing with increased randomness among lower ranks

What is the best way to analyze rank-ordered data when there are signs that respondents were less diligent/able to assign lower ranks? Is it sufficient to introduce a dummy for lower/earlier ranks into the model or should one model this directly? I…
3
votes
1 answer

interaction with a mixed logistic regression using mlogit on choice data

What is the best way to analyse interactions in choice data between an individual specific variable and an alternative specific variable? I have designed a discrete choice experiment in which participants are asked to make several dichotomous…
colonus
  • 92
  • 7
1
2 3 4 5