Hypothesis testing is a fundamental method in inferential statistics used to evaluate assumptions about a population.
Hypothesis testing is a fundamental method in inferential statistics used to evaluate assumptions about a population.
## Loading required package: ggplot2
## ## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2': ## ## last_plot
## The following object is masked from 'package:stats': ## ## filter
## The following object is masked from 'package:graphics': ## ## layout
We use test statistics such as z or t values:
\[ z = \frac{\bar{x} - \mu_0}{\sigma / \sqrt{n}} \]
\[ t = \frac{\bar{x} - \mu_0}{s / \sqrt{n}} \]
set.seed(123) group1 <- rnorm(30, mean = 5, sd = 1) group2 <- rnorm(30, mean = 5.5, sd = 1) t.test(group1, group2)
## ## Welch Two Sample t-test ## ## data: group1 and group2 ## t = -3.0841, df = 56.559, p-value = 0.003156 ## alternative hypothesis: true difference in means is not equal to 0 ## 95 percent confidence interval: ## -1.1965426 -0.2543416 ## sample estimates: ## mean of x mean of y ## 4.952896 5.678338
Hypothesis testing provides a structured framework for making data-driven decisions under uncertainty. Always interpret results in the context of the study.