The data, taken from (Cousineau 2017) , is an example where the "stand-alone" 95\% confidence interval of the means returns a result in contradiction with the result of a statistical test. The paradoxical result is resolved by using adjusted confidence intervals, here the different-adjusted confidence interval.

data(dataFigure1)

Format

An object of class data.frame.

References

Cousineau D (2017). “Varieties of confidence intervals.” Advances in Cognitive Psychology, 13, 140 -- 155. doi:10.5709/acp-0214-z .

Examples

library(ggplot2)
#> Warning: package 'ggplot2' was built under R version 4.3.3
library(gridExtra)
#> Warning: package 'gridExtra' was built under R version 4.3.3
data(dataFigure1)

options(superb.feedback = 'none') # shut down 'warnings' and 'design' interpretation messages

## realize the plot with unadjusted (left) and ajusted (right) 95% confidence intervals
plt1a <- superb(
    score ~ grp,
    dataFigure1, 
    adjustments=list(purpose = "single"), 
    plotStyle="bar" ) + 
  xlab("Group") + ylab("Score") + labs(title="95% CI\n") +
  coord_cartesian( ylim = c(85,115) ) +
  geom_hline(yintercept = 100, colour = "black", linewidth = 0.5, linetype=2)
plt1b <- superb(
    score ~ grp, 
    dataFigure1, 
    adjustments=list(purpose = "difference"), 
    plotStyle="bar" ) + 
  xlab("Group") + ylab("Score") + labs(title="Difference-adjusted 95% CI\n") +
  coord_cartesian( ylim = c(85,115) ) + 
  geom_hline(yintercept = 100, colour = "black", linewidth = 0.5, linetype=2)
plt1  <- grid.arrange(plt1a,plt1b,ncol=2)


## realise the correct t-test to see the discrepancy
t.test(dataFigure1$score[dataFigure1$grp==1], 
       dataFigure1$score[dataFigure1$grp==2],
       var.equal=TRUE)
#> 
#> 	Two Sample t-test
#> 
#> data:  dataFigure1$score[dataFigure1$grp == 1] and dataFigure1$score[dataFigure1$grp == 2]
#> t = 1.7612, df = 48, p-value = 0.08458
#> alternative hypothesis: true difference in means is not equal to 0
#> 95 percent confidence interval:
#>  -0.7082201 10.7082201
#> sample estimates:
#> mean of x mean of y 
#>       105       100 
#>