Question: I'm trying to run a t-test using `t.test()` but am confused about the p-value and confidence interval. Looking at the output I see a p-value of ~0.03. That leads me to believe I'd reject the null hypothesis at a 95% level. However, when I compare the difference in my means, 0.25, is solidly within the 95% confidence interval shown. With a small p-value I thought it would be outside, but I'm new to this whole process. How do I reconcile a small p-value with a difference within the confidence interval? Is the difference in mean not what the confidence interval shows?

```
> t.test(childs ~ vet, data = cols)
data:  childs by vet
t = 2.163, df = 130.97, p-value = 0.03236
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
 0.02163258 0.48494263
sample estimates:
mean in group FALSE  mean in group TRUE 
           2.707134            2.453846 

> 2.707 - 2.4538
[1] 0.2532

```

Answer: 
.2532 is always going to be in the confidence interval since this is how the interval was constructed. The formula is 

$(\bar{x\_1} - \bar{x\_2}) \pm t^\*\_{df} \times SE(\bar{x\_1} - \bar{x\_2})$

Further more $\bar{x\_1} - \bar{x\_2}$ is called your observed result (or sample difference in means) and as you can see this is where the interval will be centered and thus always be contained in the confidence interval.

The hypotheses you are testing are 

$H\_0: \mu\_1 - \mu\_2 = 0$ vs. $H\_1: \mu\_1 - \mu\_2 \neq 0$ 

Therefore, you when checking whether or not the null hypothesis is rejected based on the confidence interval you look to see if the null hypothesized value is in the confidence interval. In this case it is 0, since 0 is not in the interval we reject the null hypothesis at the .05 significance level. This is consistent with the decision made from the p-value.

Hopefully this helps but my response is very much an overview and there is a lot more going on conceptually here that I did not go into.
Why do smart people have such trouble explaining simple things.

1. In laymen terms, p-value = 0.03236 means there is a 97% chance sample A > sample B.
2. You're 95% confident the difference between sample A and B is between 0.02 and 0.48. This is a weird result given the difference between A and B is only 0.25. This indicates your data is skewed which probably means the 97% chance mentioned above isn't true due to T-Test assumptions being violated.

A normal 95% CI for a difference of means = 0.25 would be something smaller like 0.20 to 0.30 where you could say if my difference of means is 0.25 then the true mean is probably somewhere between 0.20 and 0.30. Your test shows true mean between 0.02 to 0.48 which is a huge range. Run a t.test on some fake data with a normal dist and the result will make sense.