This application allows users to perform either a one-sample t-test or a two-sample t-test . A one-sample t-test focuses on comparing the average of a single quantitative variable to a hypothesized value, while a two-sample t-test focuses on comparing the difference in averages of a quantitative variable between two groups to a hypothesized value. In both scenarios, the purpose of the hypothesis test is to determine how likely are the observed results or any more extreme results, under the assumption that the null hypothesis is true. This is known as a p-value.

In most data analyses, the population mean(s) along with the population standard deviation(s) are unknown. Therefore, the t-test is used instead of a z-test. The t-statistic can be calculated to determine the p-value, by comparing it to the t-distribution with a specified degrees of freedom. In this scenario, the sample standard deviation(s) replaces the population standard deviation(s) to yield the standard error (an estimate of the true standard deviation) of the sampling distribution.




One-sample t-test:

  • the parameter of interest is the population mean, μ
  • t-statistic = \(\frac{\bar x -\mu_0}{s_{x}/\sqrt{n}}\)


Two-sample t-test:

  • the parameter of interest is the difference between the two population means, μ12
  • t-statistic = \(\frac{(\bar x_1 - \bar x_2) -(\mu_1-\mu_2)}{\sqrt{\frac{s_{1}^2}{n_1} + \frac{s_{2}^2}{n_2}}}\)




Shiny app by Jimmy Wong
Base R code by Jimmy Wong
Shiny source files: GitHub Gist


Customize file format:



Shiny app by Jimmy Wong
Base R code by Jimmy Wong
Shiny source files: GitHub Gist


Hypotheses:


Hypotheses:






Shiny app by Jimmy Wong
Base R code by Jimmy Wong
Shiny source files: GitHub Gist




Test output:


Normality test: The sampling distribution of the sample means or differences in the sample means is 1) Normal if the population(s) is Normal or 2) approximately Normal if the sample size(s) is large enough (at least 30). In situations with small sample size(s), the approach to access whether the sample data could have came from a Normal distribution is either through a Q-Q plot or a Normality test.



Ho: data is from a Normal distribution
Ha: data is not from a Normal distribution

Shapiro-Wilk Normality Test: