作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在 R 中成功运行 mlogit 模型后,我在尝试获取边际效应时收到一条错误消息:
"Error in predict.mlogit(object, data) : the number of rows of the data.frame should be a multiple of the number of alternatives"
我什至尝试按照另一篇文章中的说明更改源代码中的第 16 行,但仍然出现相同的错误。任何帮助,将不胜感激。我所有的变量都不是特定的。我有4种选择。
#**model:**(ran successfully)
m<-summary(mlogit(TypOfCr~1|OneOrTwoVeh|1,data=mnldata,reflevel="PDO"))
#**means:**(ran successfully)
z <- with(mnldata, data.frame(OneOrTwoVeh=mean(OneOrTwoVeh)))
#**effects**: effects(m,covariate="OneOrTwoVeh",data=z)
effects(m,covariate="OneOrTwoVeh",data=z)
Error in predict.mlogit(object, data) :
the number of rows of the data.frame should be a multiple of the number of alternatives
以下是网络上发布的类似问题的链接,但我很难找到那里发布的解决方案。 marginal effects of mlogit in R提前致谢
最佳答案
effects()
需要一个模型对象作为它的第一个参数。但是 m
不是模型对象。相反,它是在模型对象上运行 summary()
函数的输出。而是尝试
m <- mlogit(TypOfCr~1|OneOrTwoVeh|1,data=mnldata,reflevel="PDO")
(即创建模型对象,而不是模型对象的摘要)并将其提供给 effects()
。
关于r - 如何解决mlogit边际效应错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29203057/
图像显示,但不转换。 CSS 代码显示在上传的页面上。 我正在使用 EverWeb 构建页面。 下面是我正在尝试的代码。提前致谢。 HTML 片段 CSS .image { width: 100
我是一名优秀的程序员,十分优秀!