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

SEM and custom errorbars on pointplot #2283

Closed
JoeZiminski opened this issue Sep 16, 2020 · 1 comment
Closed

SEM and custom errorbars on pointplot #2283

JoeZiminski opened this issue Sep 16, 2020 · 1 comment
Labels

Comments

@JoeZiminski
Copy link

JoeZiminski commented Sep 16, 2020

Thank you very much for this excellent resource. For my own use I have added the functionality to also plot standard error of the mean, and custom errorbars for pointplot:

starting line 1477 of categorical.py in the _PointPlotter.estimate_statistic function (shown after sd):

                    if ci == "sd":  

                        estimate = estimator(stat_data)
                        sd = np.std(stat_data)
                        confint.append((estimate - sd, estimate + sd))

                    elif ci == "sem":                                                       

                        estimate = estimator(stat_data)
                        sem = np.std(stat_data) / np.sqrt(len(stat_data))
                        confint.append((estimate - sem, estimate + sem))

                    elif ci[0] == 'custom':

                        estimate = estimator(stat_data)
                        ci_ = ci[1][i]
                        confint.append((estimate - ci_, estimate + ci_))

At the moment it is a bit ugly, and requires ci to be bassed as a two inputs (one 'custom', the other an array of errorbars). so might lead to issues in its current form. However am happy to work on it if its something youd consider having as part of the package.

Best,
Joe

@mwaskom
Copy link
Owner

mwaskom commented Sep 19, 2020

I'm -1 on special casing this, but more general support is on the roadmap.

If you want error bars that correspond to the standard error of the mean, you can also show the 68% bootstrap confidence interval.

But 95% CI is always more informative.

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

No branches or pull requests

2 participants