I am looking at the number of doctor’s visits over a 10-year period in about 2000 municipalities. Each municipality is assigned to one of five municipality types (e.g. large town, rural community, ..). I am looking at the individual years, but am also interested in describing the visits for the whole 10-year period by municipality type. For this purpose I just aggregated the data by type and calculated mean and SD

df %>% 
  group_by(municipality_type) %>% 
  select(visits) %>% 
  summarise_all(funs(count=n(),mean= mean(., na.rm = TRUE), sd = sd(., na.rm = TRUE)))

I am ignoring that the number of visits in each municipality is measured repeatedly in every municipality (every year, thus 10 times) during the observation period. Do I still get accurate means and SDs? I am aware that the number of visits can obviously not be below 0, so the number of visits might not follow a normal distribution (even if histograms look fine). But even if I calculate medians and IQRs, they might also be affected by the repeated measures.

Does anyone have a suggestion on how to calculate measures of central tendency and measures of dispersion for the whole observation period that account for the repeated measurements?


2 Answers 2


A couple of points:

  • An important consideration is repeated measurements studies is missing data. For example, for a variety of reasons it could be that the number of visits is not reported or it is lost in some municipalities for some years. In this cases, it is important to know why this may be happening, and whether the reason for incomplete data is related to the (expected) number of visits. E.g., smaller municipalities may report less accurately the number of visits. In these cases, and when the reasons why you have missing data may depend on the outcome you’re measuring (number of visits), descriptives statistics based on the observed data alone may be misleading. It is better to report model-based summaries.
  • If you have no missing data (very difficult to have in practice) or the reasons why you have missing data are not at all related with the outcome (also quite often not the case), then means based on the observed data will still be unbiased. Howevever, variances will not be because they do not account for the correlations. Depending on what summaries you are calculating, i.e., between or within municipalities the variances can be either under or over-estimated.
  • $\begingroup$ Thanks for pointing out that missing data also impact on descriptive statistiscs and that this shoule be adressed in the model. Still, if we would assume that no data is missing, is there a way to account for the correlation when calculating between variance? $\endgroup$
    – Catherine
    Jan 18, 2019 at 8:07

After discussing my problem with a couple other people this is how I solved it: As I want to display one measure for the average and varition between municipalies, I first calculated the mean (over the 10 year period) for each municipaliy and then calculated the SD for these means.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.