# Standard error for error bars - within-subject plot

I have a study design with repeated measures (10 assessments per day for multiple weeks). I was asked to make a simple bar plot for several variables. It would seem odd to me to show the bar plots without standard error bars. However, I don't know how to calculate standard errors in the case of repeated measures.

Do I divide the standard deviation by the number of subjects still? If I do that, I end up with large standard errors that overlap widely with zero (and/or other standard error bars), which seems odd since mixed-effect models have shown mostly significant effects of the predictors of interest. Such plots, therefore, would likely lead to confusion.

Alright, I found an answer to my question. So in case anybody stumbles upon this with the same question:

The Cousineau-Morey method can be used to calculate confidence intervals for repeated measures. A good introduction can be found here.

In brief, we remove the subject average from each observation and add the overall average (all subjects) to disentangle the condition-specific variability from the subject-specific variability of our data. A very useful R-package for this is Rmisc. A tutorial on creating visualizations for within-subject data (using Rmisc) is presented here.

awesome question. This should be an issue that thousands of people have so I don't understand why you didn't get more help. I'll check out this tutoiral. Also, JUST FOR FUN, here is what Chat GPT said when I asked it a similar question before I found your post: In a mixed model with repeated measurements within-person, when calculating standard deviation error bars for grand means, it is generally more appropriate to use the average within-person standard deviation rather than the grand standard deviation.

The reason for this lies in the structure of the data and the nature of the mixed model. In a mixed model, you are accounting for both fixed effects (population-level effects) and random effects (individual-specific effects). When dealing with repeated measurements within-person, the within-person variability is typically considered a random effect.

Using the average within-person standard deviation is a more accurate reflection of the variability within individuals, considering the repeated measurements for each person. It takes into account the variability between measurements within the same individual, which is a key aspect of the study design.

On the other hand, using the grand standard deviation might ignore the within-person variability and provide a less accurate representation of the overall variability in your data, especially when dealing with repeated measurements. The grand standard deviation would treat all measurements as if they are independent, neglecting the within-subject correlation.

Therefore, to appropriately represent the variability in your data when calculating standard deviation error bars for grand means in a mixed model with repeated measurements within-person, it is recommended to use the average within-person standard deviation.