简体   繁体   English

了解有序逻辑回归中的错误

[英]Understanding errors from ordinal logistic regression

I am using MASS::polr to run ordinal logistic regressions, but I am getting a lot of errors that I am hoping people can enlighten me about. 我正在使用MASS::polr进行顺序逻辑回归,但我遇到了很多错误,希望人们能启发我。

First if I run this the function fails to find starting values: 首先,如果运行此函数,该函数将无法找到起始值:

MASS::polr(as.ordered(cyl)~mpg+gear,mtcars)

So if I specify starting values, I get an error from optim stating 'non-finite value supplied by optim': 因此,如果指定起始值,则会因optim指出“ opttim提供的非有限值”而出错:

MASS::polr(as.ordered(cyl)~mpg+gear,mtcars,start=c(1,1,1,1))

After reading some R-help, and previous stack overflow questions about this, the response is usually that there is something wrong with the data ie the response variable has a category with relatively few values, but in this instance I don't see anything wrong with mtcars . 在阅读了一些R-help以及之前有关此问题的堆栈溢出问题之后,响应通常是数据有问题,即响应变量的类别值相对较少,但是在这种情况下,我看不到任何错误与mtcars

Any guidance on how to diagnose, and deal with issues in data that will impact MASS::polr would be appreciated. 任何有关如何诊断和处理将影响MASS::polr数据问题的指导,将不胜感激。

Regards 问候

Going on a scavenger hunt through ?polr , the starting values are to be specified "in the format c(coefficients, zeta) " . 通过?polr进行清道夫搜寻,起始值应“以c(coefficients, zeta)格式指定 Looking lower, we see that zeta is "the intercepts for the class boundaries." 往下看,我们看到zeta“类边界的截距”。 . In the Details section, we can see that the zeta values must be ordered: 在“ 详细信息”部分,我们可以看到zeta值必须排序:

zeta_0 = -Inf < zeta_1 < ... < zeta_K = Inf

([sic], as that presumably should be a < Inf at the end.) So you need the second zeta value to be greater than the first. ([sic],因为最后应该是< Inf 。)因此,您需要第二个zeta值大于第一个zeta值。 This works, for example: 例如,这有效:

MASS::polr(as.ordered(cyl) ~ mpg + gear, mtcars, start = c(1, 1, 1, 2))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM