0

I would like to understand the interpretation of One Sample T test in R. This is my code

x <- rnorm(100)
qqnorm(x)
qqline(x)

t.test(x,mu = 5)

I have used randomly generated normal data for the test. I understand the part that the T test wants to check whether the mean of the data x is equal to the hypothetical mean 5.

enter image description here

How will I interpret the result? Can anyone explain the meaning of the values t,df,p-value and confidence interval. Thanks for the help.

1 Answers1

2

Since the $p$-value (p) ($p < 2.2 x 10^{-16}$) of your test is extremely small, you'd reject the null hypothesis and conclude that based on this data, you cannot accept the null hypothesis (the true population mean is equal to 5), at say the 99% confidence level. In fact, your output state the alternative hypothesis which is "accepted" in this case: That the true mean is not equal to 5.

The $t$-statistic (t) was computed to be -53.531, and your test has 99 degrees of freedom (df) (in a $t$-test this is always n-1, so since you generated 100 observations $n-1 = 100-1 = 99$)

The next bit of output shows you the 95% confidence interval is from -0.2042369 to 0.1677788.

The final part of the output shows the sample mean computed from your data: -0.01822908. This is the same as as if you ran the $mean(x)$ statement in R after generating your sample.

StatsStudent
  • 11,444
  • what does the t statistic imply? What about its sign? – Archana Jalaja Surendran Sep 27 '21 at 04:36
  • Have you examined the formula for the $T$-statistic: $T={\bar{X}-\mu\over{\hat{\sigma}\over{\sqrt{n}}}}$? When will this be positive vs. negative? Large absolute values (for a two-sided test) of the $T$-statistic indicate that you're more likely to reject the null hypothesis for a given sample size. – StatsStudent Sep 27 '21 at 04:42
  • So the value -53.531 implies the significant difference between the mean and hypothetical mean? – Archana Jalaja Surendran Sep 27 '21 at 04:50
  • Essentially, yes. If you think about the $T$-statistic, when your sample mean $\bar{X}$ is close to the hypothetical/believed mean $\mu$, the values of $T$ will be close to zero. As this sample mean is further away from the hypothetical mean $\mu$, $T$ will have a larger absolute value. When $\bar{X}$ is much larger than $\mu$, then $\bar{X}-\mu$ will be large. When your sample mean $\bar{X}$ is much smaller than the hypothetical mean, then $\bar{X}-\mu$ will be much less than you (i.e. a large negative number). So for a given standard deviation and sample size, large absolute values... – StatsStudent Sep 27 '21 at 04:56
  • imply a greater chance of rejecting your null hypothesis as the T-value is more likely to exceed the test's critical value. – StatsStudent Sep 27 '21 at 04:57