2024-03-21

Understanding Hypothesis Testing

  • Hypothesis testing is a statistical method used to make inferences about population parameters based on sample data.
  • It involves testing a hypothesis about the population parameter using sample data.

Null and Alternative Hypotheses

  • Null Hypothesis (H0): Statement of no effect or no difference.
  • Alternative Hypothesis (H1 or Ha): Statement of effect or difference.

\[ \begin{align*} H_0 &: \mu = \mu_0 \\ H_1 &: \mu \neq \mu_0 \end{align*} \]

Test Statistic

  • A test statistic is a numerical summary of sample data that is used to assess the truth of the null hypothesis.
  • It measures the difference between the sample statistic and the hypothesized parameter value.

\[ \text{Test Statistic} = \frac{\text{Sample Statistic} - \text{Population Parameter}}{\text{Standard Error}} \]

Example: One-Sample Z-Test For Student Height

heights <- c(167, 170, 169, 172, 175)

mu_0 <- 170

sample_mean <- mean(heights)
sample_sd <- sd(heights)

test_statistic <- (sample_mean - mu_0) / (sample_sd / sqrt(length(heights)))

test_statistic
## [1] 0.4399413

P-Value

  • The p-value is the probability of obtaining a test statistic as extreme or more extreme than the one observed, assuming the null hypothesis is true.
  • Small p-values indicate strong evidence against the null hypothesis.

ggplot of the mean height difference

plotly of the mean height difference

ggplot to look at the heights in a new way