楼主: ReneeBK
2668 0

[疑难杂症]Which R Package Should I Use for Mixed Logit Model? [推广有奖]

  • 1关注
  • 62粉丝

VIP

学术权威

14%

还不是VIP/贵宾

-

TA的文库  其他...

R资源总汇

Panel Data Analysis

Experimental Design

威望
1
论坛币
49407 个
通用积分
51.8704
学术水平
370 点
热心指数
273 点
信用等级
335 点
经验
57815 点
帖子
4006
精华
21
在线时间
582 小时
注册时间
2005-5-8
最后登录
2023-11-26

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
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 factors like syllable position or real/non-real-word.

In the minimal example I created 4 people and their answers with the syllable position.

library(mlogit)
library(nnet)set.seed(1234)
data <- data.frame(personID = as.factor(sample(1:4, 40, replace=TRUE)),
               decision = as.factor(sample(c("Q","U", "other"), 40,
replace=TRUE)),
               syllable = as.factor(sample(1:4, 40, replace=TRUE)))
summary(data)
personID  decision  syllable
1:11     other:10   1:18
2:10     Q    :18   2: 9
3:10     U    :12   3: 5
4: 9                4: 8

As far as I know nnet's multinom function does not cover mixed models.

modNnet1 <- multinom(decision ~ syllable, data=data)

First I used the mlogit.data-function to reshape the file. After discussion with a colleague we came to the conclusion that there is no alternative.specific.variable.

dataMod <- mlogit.data(data, shape="wide", choice="decision", id.var="personID")
mod1 <- mlogit(formula = decision ~ 0|syllable,
           data = dataMod,
           reflevel="Q", rpar=c(personID="n"), panel=TRUE)
  Error in names(sup.coef) <- names.sup.coef :
    'names' attribute [1] must be the same length as the vector [0]

mod2 <- mlogit(formula = decision ~ personID|syllable,
           data = dataMod,
           reflevel="Q", rpar=c(personID="n"), panel=TRUE)
  Error in solve.default(H, g[!fixed]) :
     Lapack routine dgesv: system is exactly singular: U[3,3] = 0

No I do not know what to do, so I ask for help in here. But I believe this kind of problem can be solved with mlogit and I just don't see it yet ;)

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:package Should model Mixed Which conducted reading created package problem

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-4-28 17:25