I am having a problem analyzing some data from a recent experiment in R.

The experiment was balanced with 5 replicates in each group. It included two factors (plant type and leaf age) with 15 combinations (5 plant types x 3 age classes within each plant type).

I arranged the data in long form and conducted a two way ANOVA in R. The main effects were separately significant, but the interaction of both was not.

Now I am unsure what my next steps are.

I want to display my results in boxplots showing which plant types have significant differences, and which leaf ages are significantly different?

  • 1
    $\begingroup$ Welcome to our site. Your question is unclear: are you asking whether boxplots would be useful or are you asking how to produce those boxplots? $\endgroup$
    – whuber
    Feb 24, 2019 at 16:51
  • $\begingroup$ Box plots are typically based on medians and quartiles. ANOVA is based on means and variances or SDs. Looking at the data with boxplots might well help you understand the ANOVA, but the pertinence is indirect. $\endgroup$
    – Nick Cox
    Feb 24, 2019 at 16:56
  • $\begingroup$ Thank you for your reply! Sorry I was not clear. The issue isn't drawing the box plots. I generated those fine. What I cannot seem to do is to determine the significance of each set (and therefore box) in relation to the group. In the example I have, the significance of the set is indicated as a '*' above each box as an annotation. $\endgroup$
    – L.E
    Feb 24, 2019 at 16:58
  • $\begingroup$ The title and question are not clear then. You emphasised box plot visuallzation in your title and closed with "I want to display my results in box plots". Please consider rewriting the title and text to focus on what you want to know. $\endgroup$
    – Nick Cox
    Feb 26, 2019 at 9:21

1 Answer 1


You should try the predictmeans::predictmeans() function - this will take the fitted model and produce graphs with least significant difference bars which will clearly show which groups are different from one another. The function also allows you to chose a method for correcting when conducting multiple comparisons.

I wouldn't recommend boxplots for the above mentioned reason in the comments and they only way I have seen them used to show differences between groups is putting letters above them to show which pairs are different - this is quite confusing for the reader though.

  • $\begingroup$ Thank you for your reply! Ok, will definitely try this. I am also reconsidering the use of boxplots too. If I may ask another question though - after thinking over the stats some more, I was also considering whether a nested anova is more appropriate for my analysis rather than two way? $\endgroup$
    – L.E
    Feb 25, 2019 at 9:38
  • $\begingroup$ No worries. Personally, I typically avoid ANOVAs altogether as they have a strict set of assumptions that are rarely met, and don't usually handle complex designs well. Instead I would recommend a mixed-effects model - you can fit these with the lme4 package and they are compatible with the predictmeans function. What does your data look like? Are group sizes equal? Is your data normally distributed? How would you nest? Sorry for all the questions but I can't offer more guidance without understanding your data. $\endgroup$
    – André.B
    Feb 25, 2019 at 22:21

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.