mlogit

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

独自空忆成欢 提交于 2019-12-07 02:39: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_STD + GENDER + EXISTING_CUSTOMER, data=mlORDERS, reflevel="PRE", na.action=na.exclude) > ORDERS

Python multinomial logit with statsmodels module: Change base value of mlogit regression

一个人想着一个人 提交于 2019-12-06 09:17:32
问题 I have a little problem which I am stuck with. I am building a multinomial logit model with Python statsmodels and wish to reproduce an example given in a textbook. So far so good, but I am struggling with setting a different target value as the base value for the regression. Can somebody help?! import numpy as np import pandas as pd import statsmodels.api as sm import matplotlib.pyplot as plt #import data df = pd.read_excel('C:/.../diabetes.xlsx') #split the data in dependent and independent

Multinomial/conditional Logit Regression, Why StatsModel fails on mlogit package example?

不打扰是莪最后的温柔 提交于 2019-12-06 05:51:46
问题 I am trying to reproduce an example of a multinomial logit regression of the mlogit package in R. data("Fishing", package = "mlogit") Fish <- mlogit.data(Fishing, varying = c(2:9), shape = "wide", choice = "mode") #a pure "conditional" model summary(mlogit(mode ~ price + catch, data = Fish)) To reproduce this example with statsmodel function MNLogit, I export the Fishing data set as a csv file and do the following import pandas import statsmodels.api as st #load data df = pandas.read_csv(

multinomial mixed logit model mlogit r-package

北城余情 提交于 2019-12-04 23:52:52
问题 I discovered the mlogit -package for multinomial logit models in search of estimating a multinomial mixed logit model. After reading the excellent vignette I discovered that I could not apply my data on any of the described examples. I now write in hope of help with my problem and created a minimal example to illustrate my situation. The Problem is as follows: There are words with the consonant 'Q' somewhere. Now an experiment was conducted with people who were tasked to listen to these words

multinomial mixed logit model mlogit r-package

那年仲夏 提交于 2019-12-03 15:31:03
I discovered the mlogit - package for multinomial logit models in search of estimating a multinomial mixed logit model. After reading the excellent vignette I discovered that I could not apply my data on any of the described examples. I now write in hope of help with my problem and created a minimal example to illustrate my situation. The Problem is as follows: There are words with the consonant 'Q' somewhere. Now an experiment was conducted with people who were tasked to listen to these words and say if they heard a Q, an U or some OTHER consonant. This has to modeled in dependence of some

finding if boolean is ever true by groups in R

删除回忆录丶 提交于 2019-12-02 13:10:11
问题 I want a simple way to create a new variable determining whether a boolean is ever true in R data frame. Here is and example: Suppose in the dataset I have 2 variables (among other variables which are not relevant) 'a' and 'b' and 'a' determines a group, while 'b' is a boolean with values TRUE (1) or FALSE (0). I want to create a variable 'c', which is also a boolean being 1 for all entries in groups where 'b' is at least once 'TRUE', and 0 for all entries in groups in which 'b' is never TRUE

R mlogit model, computationally singular

北战南征 提交于 2019-12-01 06:51:55
问题 I've spent the whole of today first battling with formatting my data (updated after finding a bug via BondedDust's table(TM) suggestion) appropriately for mLogit: raw <-read.csv("C:\\Users\\Andy\\Desktop\\research\\Oxford\\Prefs\\rData.csv", header=T, row.names = NULL,id="id") raw <-na.omit(raw) library(mlogit) TM <- mlogit.data(raw, choice = "selected", shape = "long", alt.var = "dishId", chid.var = "individuals", drop.index = TRUE) Where I fail is when trying to model my data. model <-

Multinomial logit in R: mlogit versus nnet

≡放荡痞女 提交于 2019-11-29 08:34:49
问题 I want to run a multinomial logit in R and have used two libraries, nnet and mlogit, which produce different results and report different types of statistics. My questions are: What is the source of discrepency between the coefficients and standard errors reported by nnet and those reported by mlogit ? I would like to report my results to a Latex file using stargazer . When doing so, there is a problematic tradeoff: If I use the results from mlogit then I get the statistics I wish, such as

mlogit: missing value where TRUE/FALSE needed

会有一股神秘感。 提交于 2019-11-28 04:08:45
问题 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