April,17,2023

1

What is a T-test

A T-test is used to compare the means of two different groups. It is used to see if the two difference between the groups are statistically significant. Which means that differences between the two groups did not happen due to sampling error or by chance.

\({(x_1-x_2) \over (\sqrt{s^2*({1 \over n_1}-{1 \over n_2}}))}\)

The data are assumed to be these qualities in a T-test

-Independent -Normally Distributed -Homogeneity of Variance

Example two sample t-test

We have two Independent data sets. One group being Animation ratings and the other group being Romance Ratings.

Plot to see if the Romance group is Normally Distributed

ggplot(data=rom, aes(x=rating)) +
  geom_bar(stat="count", width=0.5, fill="steelblue") +
  theme_minimal()
## Warning: `position_stack()` requires non-overlapping x intervals

Plot to see if the Animation group is Normally Distributed

ggplot(data=rom, aes(x=rating)) +
  geom_bar(stat="count", width=0.7, fill="red") +
  theme_minimal()
## Warning: `position_stack()` requires non-overlapping x intervals

## Make a null hypothesis

H_0: anim=rom H_A:anim!=rom

Formula of t-test

\({(6.57-6.51) \over (\sqrt{1.17^2*({1 \over 3650}-{1 \over 4704}}))}=\)

T-test

You compare the t-test value you got and compare it values in a critical value chart. If t-test value> critical chart value then there is significant difference. If t-test value < critical cart valye then there is no significant difference