# Overlapping confidence intervals and p values

#### Emily99

##### New Member
Hi, I've been given the mean and 95% confidence interval (CI) of two independent groups and asked if they were satistically significantly different or not?
I know that if the CIs of the two groups don't overlap at all, then they can be considered as significantly different. However if the CI do overlap, it does not necessarily mean that the two groups are not significantly difference.
Is there any way to determine if the two groups with overlaping CI are significantly difference or not with only the mean and CI? Could we calcuate the p value with?
Here is an example: Group A mean 9.7 with CI 5.7 - 16.4; Group B mean 7.0 with CI 6.7 - 7.4
Thanks!

#### GretaGarbo

##### Human
You also need to know the sample size in each group.

#### ondansetron

##### TS Contributor
In the case of overlapping confidence intervals for A and B:
-if the point estimate of A is within the CI of B, then nonsignificant at the complementary alpha level for the null of equality
- if the point estimate of A is outside of the CI of B, this would be significant at the complementary alpha level for the null of equality.

This applies if A and B are swapped, too.

Am I forgetting something? @Dason, @GretaGarbo @Hlsmith

#### Dason

##### Ambassador to the humans
Your second point isn't necessarily true. For an easy to imagine counterexample think of if A is outside B's interval but the interval for A completely contains all of B's interval.

#### ondansetron

##### TS Contributor
Your second point isn't necessarily true. For an easy to imagine counterexample think of if A is outside B's interval but the interval for A completely contains all of B's interval.
I suppose if I wasnt lazy, and then extended to a nonzero null case, I would have provided the same conclusion since any numbers contained within one interval are fail to reject the null for those numbers. Thanks for the clarity!

#### Emily99

##### New Member
Makes sense. Thank you very much for your help

#### Dason

##### Ambassador to the humans
Some R code to play around with that illustrates some of the possibilities
Code:
set.seed(642)

A <- rnorm(10, 0, 1)
B <- rnorm(10, 1, 2)
t.test(A,B)
ci.A <- t.test(A)$conf ci.B <- t.test(B)$conf
df <- data.frame(means = c(mean(A), mean(B)), low = c(ci.A, ci.B), high = c(ci.A, ci.B))
df

# t-test for a difference is not significant
# conf int for A doesn't include point estimate for B
# conf int for B does include point estimate for A

set.seed(642)

A <- rnorm(10, 0, 1)
B <- rnorm(10, 1, 1)
t.test(A,B)
ci.A <- t.test(A)$conf ci.B <- t.test(B)$conf
df <- data.frame(means = c(mean(A), mean(B)), low = c(ci.A, ci.B), high = c(ci.A, ci.B))
df
# ttest for difference is not significant
# both conf ints don't contain the other point estimate but overlap

set.seed(642)

A <- rnorm(10, 0, 1)
B <- rnorm(10, 1.45, 1)
t.test(A,B)
ci.A <- t.test(A)$conf ci.B <- t.test(B)$conf
df <- data.frame(means = c(mean(A), mean(B)), low = c(ci.A, ci.B), high = c(ci.A, ci.B))
df
# ttest for difference is significant
# confidence intervals do overlap slightly but neither interval contains the other point estimate