mlogit

Error with using the mlogit R function: the two indexes don't define unique observations

落爺英雄遲暮 提交于 2021-02-10 05:14:06
问题 I've got a problem with the mlogit funtion in R. My dataset looks like this: personID caseID altID choice a1 a2 a3 a4 1 1 1 1 3 0 3 1 1 1 2 0 1 3 0 1 1 1 3 0 4 4 4 4 1 2 1 0 2 2 1 3 1 2 2 1 2 3 1 3 etc.... I've tried running the following code, performing the model. setV2 <- mlogit.data(data = setV2, choice = "choice", shape = "long", alt.var = "altID", chid.var = "personID") m <- mlogit(choice ~ a1 + a2 + a3 + a4 | -1, rpar = c(a1 = "n", a2 = "n", a3 = "n", a4 = "n"), correlation = FALSE,

Error with using the mlogit R function: the two indexes don't define unique observations

我的未来我决定 提交于 2021-02-10 05:12:36
问题 I've got a problem with the mlogit funtion in R. My dataset looks like this: personID caseID altID choice a1 a2 a3 a4 1 1 1 1 3 0 3 1 1 1 2 0 1 3 0 1 1 1 3 0 4 4 4 4 1 2 1 0 2 2 1 3 1 2 2 1 2 3 1 3 etc.... I've tried running the following code, performing the model. setV2 <- mlogit.data(data = setV2, choice = "choice", shape = "long", alt.var = "altID", chid.var = "personID") m <- mlogit(choice ~ a1 + a2 + a3 + a4 | -1, rpar = c(a1 = "n", a2 = "n", a3 = "n", a4 = "n"), correlation = FALSE,

Handling alternative-specific NA values in mlogit

◇◆丶佛笑我妖孽 提交于 2021-02-08 10:18:08
问题 It is common in mode choice models to have variables that vary with alternatives ("generic variables") but that are undefined for certain modes. For example, transit fare is present for bus and light rail, but undefined for automobiles and biking. Note that the fare is not zero. I'm trying to make this work with the mlogit package for R. In this MWE I've asserted that price is undefined for fishing from the beach. This results in a singularity error. library(mlogit) #> Warning: package

R: Can I analyze non-varying-across-individual alternative-specific attribute variables with mlogit?

人走茶凉 提交于 2021-01-29 10:39:44
问题 I'm new to discrete choice modeling, so my apologies if I am misunderstanding a fundamental aspect of the analysis. I would like to run a discrete choice analysis with an individual-specific variable and what I think are alternative-specific attribute variables. From the mlogit vignette I think the individual-specific variable is a "choice situation specific covariate" (in the new vignette) and the alternative-specific attribute variables are "alternative specific covariates with generic

R mlogit() function: Error in if (abs(x - oldx) < ftol) { : missing value where TRUE/FALSE needed

孤街浪徒 提交于 2021-01-28 09:45:52
问题 I am having trouble with mlogit() function. I am trying to predict which variables in a given set are the most preferred amongst people who took our survey. I am trying to predict the optimal combination of variables to create the most preferred option. Basically, we are measuring "Name", "Logo Size", "Design", "Theme","Flavor", and "Color". To do this, we have a large data set and are trying to run it through mlogit.data() and mlogit(), although we keep getting the same error: Error in if

R mlogit() function: Error in if (abs(x - oldx) < ftol) { : missing value where TRUE/FALSE needed

假如想象 提交于 2021-01-28 09:45:13
问题 I am having trouble with mlogit() function. I am trying to predict which variables in a given set are the most preferred amongst people who took our survey. I am trying to predict the optimal combination of variables to create the most preferred option. Basically, we are measuring "Name", "Logo Size", "Design", "Theme","Flavor", and "Color". To do this, we have a large data set and are trying to run it through mlogit.data() and mlogit(), although we keep getting the same error: Error in if

mlogit in R - coefficients and unknown random parameter

自作多情 提交于 2020-08-26 07:04:07
问题 I'm trying to run mlogit on my data. My data is: > head(df[c(1:3, 33:45)]) ID Gender Age Option equipment.A equipment.B equipment.C clean.A clean.B clean.C people.A people.B people.C price.A price.B 1 108630 M 56 A 3 3 1 1 3 3 2 3 2 4 3 2 115547 F 34 B 3 3 1 1 3 3 2 3 2 4 3 3 118359 F 51 C 3 3 1 1 3 3 2 3 2 4 3 4 126656 F 40 C 3 3 1 1 3 3 2 3 2 4 3 5 127439 F 26 C 3 3 1 1 3 3 2 3 2 4 3 6 130846 M 69 C 3 3 1 1 3 3 2 3 2 4 3 price.C 1 4 2 4 3 4 4 4 5 4 6 4 My code is: Result <- mlogit.data

Error with using mlogit R function: “The two indexes don't define unique observations”

扶醉桌前 提交于 2020-07-10 09:00:08
问题 My dataset look like this ID choice_situation Alternative Attr1 Attr2 Attr3 choice ID_1 1 1 0 0 0 0 ID_1 1 2 1 1 0 1 ID_1 2 1 1 1 0 0 ID_1 2 2 1 1 1 1 ID_1 3 1 2 1 0 1 ID_1 3 2 3 1 0 0 ID_2 1 1 3 0 1 1 ID_2 1 2 0 0 0 0 ID_2 2 1 2 1 1 0 ID_2 2 2 2 1 1 1 ID_2 3 1 0 0 0 1 ID_2 3 2 0 0 1 0 ..... Every time I run the code of mlogit function DCE_data<- mlogit.data(data=dataset, choice = "choice", shape = "long", alt.var = "Alternative", id.var = "ID") #ok model<- mlogit(choice ~ Attr1 + Attr2 +

multinomial logistic regression in R: multinom in nnet package result different from mlogit in mlogit package?

纵饮孤独 提交于 2020-05-13 08:04:13
问题 Both R functions, multinom (package nnet ) and mlogit (package mlogit ) can be used for multinomial logistic regression. But why this example returns different result of p values of coefficients? #prepare data mydata <- read.csv("http://www.ats.ucla.edu/stat/data/binary.csv") mydata$rank <- factor(mydata$rank) mydata$gre[1:10] = rnorm(10,mean=80000) #multinom : test = multinom(admit ~ gre + gpa + rank, data = mydata) z <- summary(test)$coefficients/summary(test)$standard.errors # For

Calculating multinomial logit model prediction probabilities

試著忘記壹切 提交于 2020-02-22 22:41:31
问题 Please try to give parameterize solution (there are more than three alternatives). I have a dict with beta values: {'B_X1': 2.0, 'B_X2': -3.0} And this data frame: X1_123 X1_456 X1_789 X2_123 X2_456 X2_789 6.75 4.69 9.59 5.52 9.69 7.40 7.46 4.94 3.01 1.78 1.38 4.68 2.05 7.30 4.08 7.02 8.24 8.49 5.60 7.88 8.11 5.98 4.60 1.39 1.80 8.28 9.16 7.34 7.69 6.16 3.73 6.93 8.93 2.58 3.48 6.04 8.06 8.88 7.06 6.76 4.68 7.82 5.00 7.29 5.86 3.92 5.67 4.10 2.49 2.55 4.66 7.15 6.26 7.87 1.50 3.35 5.70 9.86 4