Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn t-test Mathematically | Statistical Testing
Learning Statistics with Python

bookt-test Mathematically

The task of the t-test is to determine whether the difference between the two samples' means is significant. What should you take into consideration to perform it?

Obviously, you should consider the difference between the means itself.

As shown in the image below, the variance matters too.

Also, the size of each sample should be taken into consideration.

To account for the difference between the means, simply calculate that difference:

xΛ‰1βˆ’xΛ‰0\bar{x}_1-\bar{x}_0

The situation becomes more complex when it comes to variance. The t-test assumes that the variance is equal for both samples. This will be explored further in the t-test assumptions chapter. To estimate the variance from two samples, the pooled variance formula is applied.

spooled2=s12β‹…df1+s22β‹…df2df1+df2=s12(n1βˆ’1)+s22(n2βˆ’1)n1+n2βˆ’2s^2_{pooled} = \frac{s^2_1 \cdot df_1 + s^2_2 \cdot df_2}{df_1 + df_2} = \frac{s^2_1(n_1-1)+s^2_2(n_2-1)}{n_1+n_2-2}

Where:

  • n1n_1 - size of i-th sample;
  • df1=niβˆ’1df_1 = n_i - 1 - i-th degree of freedom;
  • si2s_{\raisebox{-1pt}{i}}^{\raisebox{1pt}{2}} - i-th sample variance.

And to account for the size, it needs sample sizes:

n1,n2βˆ’areΒ theΒ sampleΒ sizesn_1, n_2 - \text{are the sample sizes}

Put it all together into t-statistic.

t=xΛ‰1βˆ’xΛ‰0spooled2Β β‹…Β 1n1+1n2t = \frac{\bar{x}_1-\bar{x}_0}{\sqrt{s^2_{pooled}}\ \cdot\ \sqrt{\frac{1}{n_1}+\frac{1}{n_2}}}

Sample sizes may not always be used in the most intuitive manner. However, this approach ensures that t follows the t-distribution, which will be explored in the next chapter.

question mark

What sample properties does the t-test take into account?

Select the correct answer

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 6. ChapterΒ 3

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

Suggested prompts:

Can you explain what the t-distribution is and why it's important for the t-test?

What are the main assumptions of the t-test?

Could you provide an example of how to calculate the t-statistic with sample data?

Awesome!

Completion rate improved to 2.63

bookt-test Mathematically

Swipe to show menu

The task of the t-test is to determine whether the difference between the two samples' means is significant. What should you take into consideration to perform it?

Obviously, you should consider the difference between the means itself.

As shown in the image below, the variance matters too.

Also, the size of each sample should be taken into consideration.

To account for the difference between the means, simply calculate that difference:

xΛ‰1βˆ’xΛ‰0\bar{x}_1-\bar{x}_0

The situation becomes more complex when it comes to variance. The t-test assumes that the variance is equal for both samples. This will be explored further in the t-test assumptions chapter. To estimate the variance from two samples, the pooled variance formula is applied.

spooled2=s12β‹…df1+s22β‹…df2df1+df2=s12(n1βˆ’1)+s22(n2βˆ’1)n1+n2βˆ’2s^2_{pooled} = \frac{s^2_1 \cdot df_1 + s^2_2 \cdot df_2}{df_1 + df_2} = \frac{s^2_1(n_1-1)+s^2_2(n_2-1)}{n_1+n_2-2}

Where:

  • n1n_1 - size of i-th sample;
  • df1=niβˆ’1df_1 = n_i - 1 - i-th degree of freedom;
  • si2s_{\raisebox{-1pt}{i}}^{\raisebox{1pt}{2}} - i-th sample variance.

And to account for the size, it needs sample sizes:

n1,n2βˆ’areΒ theΒ sampleΒ sizesn_1, n_2 - \text{are the sample sizes}

Put it all together into t-statistic.

t=xΛ‰1βˆ’xΛ‰0spooled2Β β‹…Β 1n1+1n2t = \frac{\bar{x}_1-\bar{x}_0}{\sqrt{s^2_{pooled}}\ \cdot\ \sqrt{\frac{1}{n_1}+\frac{1}{n_2}}}

Sample sizes may not always be used in the most intuitive manner. However, this approach ensures that t follows the t-distribution, which will be explored in the next chapter.

question mark

What sample properties does the t-test take into account?

Select the correct answer

Everything was clear?

How can we improve it?

Thanks for your feedback!

SectionΒ 6. ChapterΒ 3
some-alt