# Chapter 5 | Exercise 2

Create a bar plot with the 95% confidence intervals around the means of the imagery scores for the high- and low-frequency nouns in the data frames `pym_high`

and `pym_low`

. Is there a substantial overlap between the confidence intervals?

First, load the package and the data sets if you have not done so yet.

```
> library(Rling)
> data(pym_high)
> data(pym_low)
> se.high <- sd(pym_high$imag)/sqrt(length(pym_high$imag)) #SE for high-frequency nouns
> se.low <- sd(pym_low$imag)/sqrt(length(pym_low$imag)) #SE for low-frequency nouns
> ci.upper.high <- mean(pym_high$imag) + 1.96*se.high #upper boundary of CI for high-frequency nouns
> ci.lower.high <- mean(pym_high$imag) - 1.96*se.high #lower boundary of CI for high-frequency nouns
> ci.upper.low <- mean(pym_low$imag) + 1.96*se.low #upper boundary of CI for high-frequency nouns
> ci.lower.low <- mean(pym_low$imag) - 1.96*se.low #lower boundary of CI for high-frequency nouns
> ci.lower <- c(ci.lower.high, ci.lower.low)
> ci.upper <- c(ci.upper.high, ci.upper.low)
> means <- c(mean(pym_high$imag), mean(pym_low$imag)) #means
> library(gplots)
> barplot2(means, plot.ci = TRUE, ci.l = ci.lower, ci.u = ci.upper, main = "Bar plot with 95% confidence intervals", xlab = "Frequency groups", ylab = "Average imagery scores", names = c("High","Low"))
```

The bar plot shows that the 95% confidence intervals overlap to a large extent.