mnlogit 错误(错误 in if(nrow(data)%%K) stop...参数不能解释为逻辑)

时间:2021-04-15 21:02:06

标签: r mlogit

我正在使用 mnlogit 在 R 中处理多变量逻辑回归代码,该代码在我几个月前创建脚本时运行时没有错误。

现在,当我执行

test_last = mnlogit(data = Test_Final, reflevel = "0", ncores = 8, formula = fm)

其中 fm 被定义为

fm = formula(outcome_dict ~ 1| Var_ + .... + Var_n)

mnlogit 抛出以下错误。它似乎在抱怨 mnlogit 函数本身的语法,而不是我的函数或数据框中的任何内容,即条件语句是无法解释的:

Error in if (nrow(data)%%K) stop("Mismatch between number of rows in data and number of choices.") : 
 argument is not interpretable as logical

我看到一些 reddit 帖子有完全相同的问题,但没有任何建议的解决方案或解释。我能想到的是,自从我大约半年前上次使用这个脚本以来,可能出现了库版本不兼容的问题。任何建议将不胜感激。

0 个答案:

没有答案
相关问题