Skip to content
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

Highlighting when pval below threshold #138

Open
davidkurland opened this issue Jan 17, 2023 · 3 comments
Open

Highlighting when pval below threshold #138

davidkurland opened this issue Jan 17, 2023 · 3 comments

Comments

@davidkurland
Copy link

Is there are way to call out or highlight a cell when p<0.05?

@tompollard
Copy link
Owner

@davidkurland Not currently, as far as I'm aware, I'm sorry. We could potentially add it, so I'll keep this issue open.

@tompollard
Copy link
Owner

@jraffa @davidkurland how about adding a new pval_threshold argument. If the p-value is less than or equal to the threshold, we display a * after the value?

@tompollard
Copy link
Owner

I have added a draft implementation on the https://github.com/tompollard/tableone/tree/tp/pval_threshold branch, if you'd like to give it a try.

Clone the repo, switch to the pval_threshold branch (git switch pval_threshold), then pip install . within the folder to install.

from tableone import TableOne, load_dataset

data = load_dataset('pn2012')

table1 = TableOne(data, groupby="death", pval=True, pval_threshold=0.2)
print(table1.tabulate(tablefmt = "github"))
Missing Overall 0 1 P-Value
n 1000 864 136
Age, mean (SD) 0 65.0 (17.2) 64.0 (17.4) 71.7 (14.0) <0.001*
SysABP, mean (SD) 291 114.3 (40.2) 115.4 (38.3) 107.6 (49.4) 0.134*
Height, mean (SD) 475 170.1 (22.1) 170.3 (23.2) 168.5 (11.3) 0.304
Weight, mean (SD) 302 82.9 (23.8) 83.0 (23.6) 82.3 (25.4) 0.782
ICU, n (%) CCU 0 162 (16.2) 137 (15.9) 25 (18.4) <0.001*
CSRU 202 (20.2) 194 (22.5) 8 (5.9)
MICU 380 (38.0) 318 (36.8) 62 (45.6)
SICU 256 (25.6) 215 (24.9) 41 (30.1)
MechVent, n (%) 0 0 540 (54.0) 468 (54.2) 72 (52.9) 0.862
1 460 (46.0) 396 (45.8) 64 (47.1)
LOS, mean (SD) 0 14.2 (14.2) 14.0 (13.5) 15.4 (17.7) 0.386

@jraffa @davidkurland Please let me know your thoughts!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants