equatiomatic icon indicating copy to clipboard operation
equatiomatic copied to clipboard

Incorrect formula for polr models

Open humburg opened this issue 4 years ago • 5 comments

For MASS::polr models the output I get from extract_eq() looks something like this: image

Here the left-hand side of the equation seems to have the form logit(P(j >= j+1)). I don't think that is right (unless I'm missing something?). I would have expected something like logit(P(Y <= j)) for the model used by polr (see the help page or here).

humburg avatar Jan 31 '22 21:01 humburg

Thanks, and yes, this looks to be an error. I'll try to get a fix out soon.

Just to be sure - this should be as easy as just flipping the sign from >= to <=, right?

datalorax avatar Feb 01 '22 22:02 datalorax

Thanks for looking into this. It definitely should be <= but I'm also a bit confused about the P(levelA <= levelB) notation. I believe this should be the probability that the response is less than or equal to the given level (levelB in this example). I would write this as P(Y <= levelB).

humburg avatar Feb 01 '22 22:02 humburg

Yup, I see what you're saying. This is really odd... not sure how or why we implemented it like this. Must've gotten confused somewhere along the way.

Basically, it should be P(Y <= 1) / 1 - P(Y <= 1) for the first line, and P(Y <= 2) / 1 - P(Y <= 2) for the second, correct?

datalorax avatar Feb 01 '22 23:02 datalorax

Basically, yes. The screenshot above has labels starting at 0, so it should be P(Y <= 0) / 1 - P(Y <= 0) and P(Y <= 1) / 1 - P(Y <= 1) but you get the idea.

As a side note, if you'd like a slightly more compact notation, P(Y <= 1) / P(Y > 1) would also work.

humburg avatar Feb 02 '22 02:02 humburg

Great, thank you for this. I'll get a fix in the next little bit and will probably ask you to play around with it to make sure it's correct before I merge it in, if you happen to have the time to do that.

datalorax avatar Feb 02 '22 17:02 datalorax

This was fixed in #227

datalorax avatar Dec 05 '23 19:12 datalorax