I’m interested in the calculated confidence interval, not the p-value necessarily. Noodling around some more, I think I’m starting to understand it more: the confidence interval isn’t calculated with respect to the H0 of 0 which the R code defaults to, it’s calculated based purely on the mean (and then an H0 of 0 is assumed to spit out some p-value)
R> set.seed(12345); t.test(rnorm(20,100,15))
One Sample t-test
data: rnorm(20, 100, 15)
t = 36.16, df = 19, p-value < 2.2e-16
alternative hypothesis: true mean is not equal to 0
95 percent confidence interval:
95.29 107.00
sample estimates:
mean of x
101.1
R>
R> 107-95.29
[1] 11.71
R> 107 - (11.71/2)
[1] 101.1
Hm… I’m trying to fit this assumption into your framework....
Either h0, true mean = sample mean; or ha, true mean != sample mean
construct the test statistic: ‘t = sample mean—sample mean / s/sqrt(n)’
A 95% confidence interval is sort of like testing H0:mu=c vs Ha:mu=\=c for all values of c at the same time. In fact if you reject the null hypothesis for a given c when c is outside your calculated confidence interval and fail to reject otherwise, you’re performing the exact same t-test with the exact same rejection criteria as the usual one (that is if the p-value is less than 0.05).
The formula for the test statistic is (generally) t = (estimate—c)/(standard error of estimate) while the formula for a confidence interval is (generally) estimate +/- t^(standard error of estimate) where t^ is a quantile of the t distribution with appropriate degrees of freedom, chosen according to your desired confidence level. t^* and the threshold for rejecting the null in a hypothesis test are intimately related. If you google “confidence intervals and p values” I’m sure you’ll find a more polished and detailed explanation of this than mine.
I’m interested in the calculated confidence interval, not the p-value necessarily. Noodling around some more, I think I’m starting to understand it more: the confidence interval isn’t calculated with respect to the H0 of 0 which the R code defaults to, it’s calculated based purely on the mean (and then an H0 of 0 is assumed to spit out some p-value)
Hm… I’m trying to fit this assumption into your framework....
Either h0, true mean = sample mean; or ha, true mean != sample mean
construct the test statistic: ‘t = sample mean—sample mean / s/sqrt(n)’
‘t = 0 / s/sqrt(n)’; t = 0
… a confidence interval
A 95% confidence interval is sort of like testing H0:mu=c vs Ha:mu=\=c for all values of c at the same time. In fact if you reject the null hypothesis for a given c when c is outside your calculated confidence interval and fail to reject otherwise, you’re performing the exact same t-test with the exact same rejection criteria as the usual one (that is if the p-value is less than 0.05).
The formula for the test statistic is (generally) t = (estimate—c)/(standard error of estimate) while the formula for a confidence interval is (generally) estimate +/- t^(standard error of estimate) where t^ is a quantile of the t distribution with appropriate degrees of freedom, chosen according to your desired confidence level. t^* and the threshold for rejecting the null in a hypothesis test are intimately related. If you google “confidence intervals and p values” I’m sure you’ll find a more polished and detailed explanation of this than mine.