OHDSI / CohortDiagnostics

An R package for performing various cohort diagnostics.
https://ohdsi.github.io/CohortDiagnostics
40 stars 45 forks source link

Index Event Breakdown shows concepts with percentages >100% when "show as percentage" is selected #1026

Open conovermitch opened 1 year ago

conovermitch commented 1 year ago

In the CohortDiagnostics dashboard, when you are inspecting a cohort that allows a single person to generate multiple events ("all events" cohorts), the Index Event Breakdown tab can show percentages >100%.

Note that this link is only accessible to people who are on the JNJ network, but this dashboard exhibits the behavior described above and is the source of the screen-grabs included below: https://sharedshiny-prod.jnj.com/user/mconove1/OHDAWorkshop2023/DiagnosticsExplorer/

image

If I'm understanding these statistics correctly, clicking the radio buttons for "records" and "show as percentage" should yield a list of concepts with percentages that add to 100% (or less if some records are censored from output due to low cell count). This should be true regardless of whether your cohort does or does not allow multiple entry events per person.

Clarifying point - When you select "persons" as unit of analysis, the sum of percentages (summing across listed concepts) is larger than 100%. To me, this should be the case if you allow multiple cohort entries per person, given that one single person potentially corresponds to multiple cohort entry events (see image below). If you do not allow multiple cohort entries per person, the sum of the percentages should be 100% when "persons" is selected as the unit of analysis.

image

Please reach out to me (mconove1@its.jnj.com) if I can help clarify this error further

gowthamrao commented 1 year ago

While there may still be another bug, this assumption is incorrect

should yield a list of concepts with percentages that add to 100%

A person/event may enter because of two different concept id on the same index date. So the sum of percents can be greater than 100%