There is an inbuilt function for sd. It's called mean_sdl. The default is mean +/- 2SD, so you need to pass on arguments to get mean +/- 1SD. So the function will look like: stat_summary(fun.data = "mean_sdl", fun.args = list(mult = 1), geom = "errorbar", width = 0.4) That list(mult = 1) is the multiples of SD that should be computed, and by default it is kept to 2 since looking at overlap of errorbars plotted with 2SD gives a good indication whether a result is significantly different or not by a t-test.
Very nice video!!! As an alternative to changing the y axis (around 25:40) one can use the expansion function. The expansion function let you choose multiplicative and additive expansion of the y axis.
Great video! I wish patterns within graphs were more natural to ggplot syntax, there are cases where they can be very useful (not in this case though haha)
the whole thing where error bars sometimes are standard error and sometimes standard deviation is so weird to me. what is the story with that! i ran into this trying to see what geom_errorbar(stat="summary") was doing, i think it is +/- one standard error, similar to what you saw with it defaulting to mean_se(). i guess sometimes good to see the underlying distribution vs the simple bar :) also pretty odd that you have to manually place the error bar, i wonder if there is a more natural way to get it to the right center position. but as always, great video!
There is an inbuilt function for sd. It's called mean_sdl. The default is mean +/- 2SD, so you need to pass on arguments to get mean +/- 1SD.
So the function will look like:
stat_summary(fun.data = "mean_sdl", fun.args = list(mult = 1), geom = "errorbar", width = 0.4)
That list(mult = 1) is the multiples of SD that should be computed, and by default it is kept to 2 since looking at overlap of errorbars plotted with 2SD gives a good indication whether a result is significantly different or not by a t-test.
Great video, I really enjoy watching you code!
My pleasure - thanks for watching!
Very nice video!!! As an alternative to changing the y axis (around 25:40) one can use the expansion function. The expansion function let you choose multiplicative and additive expansion of the y axis.
Thanks - I personally find expansion() not super intuitive. I'll have to keep working with it
Great video! I wish patterns within graphs were more natural to ggplot syntax, there are cases where they can be very useful (not in this case though haha)
Thanks! Stay tuned for Wednesday's video 🤓
the whole thing where error bars sometimes are standard error and sometimes standard deviation is so weird to me. what is the story with that!
i ran into this trying to see what geom_errorbar(stat="summary") was doing, i think it is +/- one standard error, similar to what you saw with it defaulting to mean_se(). i guess sometimes good to see the underlying distribution vs the simple bar :)
also pretty odd that you have to manually place the error bar, i wonder if there is a more natural way to get it to the right center position. but as always, great video!
Thanks for watching! It seems everyone has a different opinion on SD/SE 🤣
Great video, I really enjoy watching you code!
Glad to hear it! 🤓