mlogit

R: na.action=na.exclude not working with mlogit

痞子三分冷 提交于 2020-01-23 17:18:28
问题 I am trying to add the fitted values of my multinomial logistic regression to the original data frame (called "ORDERS"). Unfortunately this is not possible, as apparently the predicted probabilities and the data frame don't have the same length - even though I use na.exclude in the regression. Maybe this has something to do with the necessary mlogit.data transformation, so that na.exclude does not work? mlModel_refPRE_STD <- mlogit(PAYMENT_METHOD ~ 1 | GROSS_RETAIL_TOTAL_STD + SOLVENCY_SCORE

mlogit: missing value where TRUE/FALSE needed

三世轮回 提交于 2020-01-04 04:35:11
问题 I have data from a discrete choice experiment (DCE), looking at hiring preferences for individuals from different sectors. that I've formatted into long format. I want to model using mlogit. I have exported the data and can successfully run the model in Stata using the asclogit command, but I'm having trouble getting it to run in R. Here's a snapshot of the first 25 rows of data: > data[1:25,] userid chid item sector outcome cul fit ind led prj rel 1 11275 211275 2 1 1 0 1 0 1 1 1 2 11275

Error in a bivariate logistic model in R

不羁岁月 提交于 2019-12-24 08:04:18
问题 I have an unexpected error in my research. Let me show you several code chunks from my research. Hope, you'll help me. I have two binary variables: alco and smoke that were generated like this: smoke<- factor(with(df, ifelse((q34<2),1,0))) alco<-factor(with(df, ifelse((q47==1), 1,0))) df<- cbind(df, smoke, alco, educ_3, smoke_14) I tried to analyse a model using zeligverse package m3<-zelig(cbind(smoke,alco) ~ fem+age+age2+smoke_14+ninc, model = "blogit", data = df) that lead to the mistake

How to get average marginal effects (AMEs) with standard errors of a multinomial logit model?

核能气质少年 提交于 2019-12-23 22:43:04
问题 I want to get the average marginal effects (AME) of a multinomial logit model with standard errors. For this I've tried different methods, but they haven't led to the goal so far. Best attempt My best attempt was to get the AMEs by hand using mlogit which I show below. library(mlogit) ml.d <- mlogit.data(df1, choice="Y", shape="wide") # shape data for `mlogit()` ml.fit <- mlogit(Y ~ 1 | D + x1 + x2, reflevel="1", data=ml.d) # fit the model # coefficient names c.names <- names(ml.fit$model)[-

Including opt-out as alternative specific constant in R Mlogit

给你一囗甜甜゛ 提交于 2019-12-23 03:17:26
问题 I am doing a discrete choice experiment on preferences for attributes of a hypothetical drug treating weight loss in my master thesis, and I need a little help. My design is generic, and has 12 choice sets with three alternatives: Product A , Product B and Option out . Somehow, I need to include option-out as an alternative specific constant, but it seems like I am doing something wrong here. I have 197 responses on 12 choice sets of three alternatives, hence 197*12*3 observations of choice =

Including opt-out as alternative specific constant in R Mlogit

两盒软妹~` 提交于 2019-12-23 03:17:13
问题 I am doing a discrete choice experiment on preferences for attributes of a hypothetical drug treating weight loss in my master thesis, and I need a little help. My design is generic, and has 12 choice sets with three alternatives: Product A , Product B and Option out . Somehow, I need to include option-out as an alternative specific constant, but it seems like I am doing something wrong here. I have 197 responses on 12 choice sets of three alternatives, hence 197*12*3 observations of choice =

Multistage Nested Logit R

笑着哭i 提交于 2019-12-22 07:05:46
问题 I want to estimate a nested logit model using the language R. As standard packages for such problems I am using "mlogit". Now I would like to estimate a model, with more than just one stage. The problem is as follows: Stage: People decide, if they want to migrate to the US or not. Stage: For all people decided to migrate, they have to decide in which region of the US they want to go (US devided in 6 regions) Stage: Within the region, they decide in what kind of area they want to live; urba vs

R mlogit on my data giving error 'system is computationally singular?

纵饮孤独 提交于 2019-12-12 21:33:14
问题 Could anyone explains what is the error and how could I resolve it? > C.m<-mlogit(choice~TotalAmount,data=C) Error in solve.default(H, g[!fixed]) : system is computationally singular: reciprocal condition number = 6.87101e-23 回答1: Something in your data is computationally singular e.g. some of the columns you are trying to do the regression on are correlated. Maybe you can remove some of the correlated columns and try again without them. 来源: https://stackoverflow.com/questions/18978572/r

mlogit duplicate 'row.names' are not allowed

元气小坏坏 提交于 2019-12-11 20:34:02
问题 New to R and want to use mlogit function. However after putting my data into a data frame and run x <- mlogit.data(mlogit, choice="PlacedN", shape="long", alt.var="RaceID") I get duplicate 'row.names' are not allowed I can upload my file if needed I've spent days trying to get this to work, so any help will be appreciated 回答1: You may want to put "RaceID" into the alt.levels argument instead of alt.var . From the mlogit.data help file: alt.levels the name of the alternatives: if null, for a

Formatting data for mlogit

左心房为你撑大大i 提交于 2019-12-11 02:27:51
问题 I am having a murderous time getting my data set in shape for a multinomial logit analysis via mlogit. My data set is available from the url in the code below. I'm getting the following error: Error in row.names<-.data.frame ( *tmp* , value = c("1.Accessible", "1.Accessible", : duplicate 'row.names' are not allowed I've checked elsewhere and this problem seems to come up. I've tried playing with the alt.levels as opposed to the alt.var argument, and that doesn't work. #Loadpackages library