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

flexplots sterr errorbars #121

Open
amanasj opened this issue Sep 27, 2023 · 0 comments
Open

flexplots sterr errorbars #121

amanasj opened this issue Sep 27, 2023 · 0 comments

Comments

@amanasj
Copy link

amanasj commented Sep 27, 2023

Hello Dustin. First thank you for the wonderful packages, they've been really helpful.

I noted whist using the sterr option on flexplot that the errorbars were inconsistent with ones I produced manually when plotting in ggplot. Looking through the flexplot helper functions (where sterr is calculated) you have:

else if (spread=="sterr"){
summary1 = "stat_summary(fun.y='mean', geom='point', size=3, position=position_dodge(width=.5), color = '#bf0303')"
summary2 = "stat_summary(geom='errorbar', fun.ymin = function(z){mean(z)-1.96*(sd(z)/sqrt(length(z)-1))}, fun.ymax = function(z){mean(z)+1.96*(sd(z)/sqrt(length(z)-1))}, width=.2, linewidth = 1.25, position=position_dodge(width=.2), color = '#bf0303')"

Is this the correct calculation for SEM? Should it not be SEM=SD/sqrt(n)? You have a 1.96 multiplier which I think is for 95% CI's and you also have an n-1 term which is for sample SD calc. Any clarification would be greatly appreciated.

Thanks
Aman

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

1 participant