-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ordinal logit regression: cutoff ordering during optimization #81
Comments
Hi @Rubaiyat-Alam, is this something you are experiencing with the package or in your implementation of ordinal logistic regression? The key to avoiding that issue is a nice optimization trick, Econometrics.jl/src/solvers.jl Line 259 in 0146365
Basically, the parameter that the model optimizes is the log of the partial addition. In other words, when recovering the thresholds, you ensure that those are monotonically increasing since you are taking the cumulative addition of positive values ensured by taking the exponent of the parameter estimates. Let me know if that helps in what you are asking. |
Could you share a sample dataset that triggers the error to help me debug this? |
I might be have a bit of time to look into it in case you can share a MRE. Thanks! |
Closing because of stale. Feel free to re-open if anything new on it. |
Hello,
I'm running the ordinal response model in Econometrics.jl (which corresponds to Stata's ologit) and am experiencing an error. For certain specs, after I run the ologit, I get an error which says that log is being taken of a negative value. The same spec works fine on Stata. I coded up the ologit in Julia, and it looks like the ordering of the cutoff is not being maintained over the optimization process. I explain in detail below.
In ordinal logit we must have that cutoff 1 < cutoff 2 < cutoff 3 < .... and so on. This ordering must hold at all times during the optimization because Pr(d = j |X) = F(cutoff_j ... |X) - F(cutoff_j-1 .... |X), so if cutoff_{j - 1} > cutoff_{j}, then Pr(d = j |X) becomes negative. Since ologit estimation requires taking logs of probability, this could end up in taking log of a negative value, throwing an error.
What happens when I run ologit is that as the optimizer perturbs over differing values of the cutoff, it sometimes uses trial values where cutoff_{j - 1} > cutoff_j, which throws an error of logs being taken of a negative value.
My guess is that the optimization problem for ologit needs to include a constraint of the cutoffs following the right ordering, and that will be enough.
I'm not attaching a MWE that showcases the error - I run into this error for my research dataset and haven't constructed a fake dataset that recreates this. If the above isn't clear please let me know, I'll try to come up with a MWE. I can also post screenshots of the error (which basically says log of a negative value is being taken) if it helps.
And thanks for creating and updating the package in general! Let me know if more info is needed.
The text was updated successfully, but these errors were encountered: