{
  "$type": "site.standard.document",
  "bskyPostRef": {
    "cid": "bafyreibkupgxldw4kyb7gx53f7uiurtfmy6t6rv3skrqiyj7wvogezm3jy",
    "uri": "at://did:plc:wwyqal4cnqhuwyacdj7rqq3n/app.bsky.feed.post/3mkbggzjkhib2"
  },
  "path": "/t/experimenting-with-a-bayesian-partial-proportional-odds-model/28677#post_4",
  "publishedAt": "2026-04-24T17:12:38.000Z",
  "site": "https://discourse.datamethods.org",
  "textContent": "This is very fascinating. I have a couple of thoughts.\n\nMy main wondering is whether CPPO is struggling to fit the mortality part of your data. Your code helpfully reports the posterior median of OR_Survival as being 1.59 (comparing UC to PCT), which is quite a bit smaller than the empiric OR of 2.25 (based on a 20% versus 10% mortality rates in the UC and PCT groups, respectively), so not a great fit there. And your model predicts a ~6.0% absolute mortality difference, which is also less than the observed 10% value. I think the reason is that the tau_death parameter in the CPPO model can only shift probability mass from the death category to the category immediately below (survivors who receive 28 days of antibiotics), but the data do not support that that is what is happening; rather, the patients who are rescued seem to be distributed across the other categories. So CPPO is sort of splitting the difference: in your Posterior Predictive Check plot, the dot for PCT at the highest category is resting pretty solidly above the observed data in the bar. I had a similar problem recently and we posited that the people who were rescued from the highest category (also mortality) would likely be distributed across the other outcomes (adverse events in our case; antibiotic treatment days in your case) rather than all being moved to the category immediately below death. To achieve this, we proposed a joint model: one modeling the probability of mortality and another _conditional_ proportional odds model for the remaining categories, given that the patient survived, and then conducted a 2df test on both treatment effects. This completely separated the treatment effect on mortality from the treatment effect on adverse events. This would help you directly answer the third question you posed (“In patient that did get treated with antibiotics and survived, did it reduce the total duration of therapy?”). And as a nice side benefit there are no hard constraints on the value of the treatment effects in this joint model formulation, like there are for tau_avoidance and tau_death (see first possible typo below for more on this).\n\n**Possible typos**\n\nAs you suspected, I think there may be a few typos in the STAN program, although I don’t think any are impacting your fitted model. The first is that tau_avoidance and tau_death have natural constraints on their values in order to satisfy standard probability requirements: \\tau_{death} \\leq \\alpha_{K-1} - \\alpha_{K-2} and \\tau_{avoidance} \\geq \\alpha_1 - \\alpha_2\n\nI think these constraints would ideally be built into the code. I’m guessing this is also why your generated quantities block has a check for whether the raw_prob is greater than 0. If you add this constraint you shouldn’t ever encounter probabilities < 0 in your model. Second, on line 3 the lower bound of K should be 4 not 3; when K=3, I think you will only be able to identify two of \\beta_{duration}, \\tau_{avoidance}, and \\tau_{death}. Your code would also not work as expected in the for loop on lines 23-25, since K-2 is less than 2 in this case:\n\n\n    for (c in 2:(K-2)) {\n        beta_c[c] = beta_duration;\n    }\n\n\nA third typo is that immediately after this for loop, you have `beta_c[29] = beta_duration + tau_death;` but I think you want `beta_c[K-1] = beta_duration + tau_death`. Again I don’t think this is affecting your model fit because in your case 29 = K-1.\n\nNot a typo, but I wonder if the program would be a bit faster if you avoided defining mu in your model statement and instead replaced each instance of `mu[k]`with `X[n]*beta_c[k]`. I’m not 100% confident in that, though.",
  "title": "Experimenting with a Bayesian Partial Proportional Odds Model"
}