2026-06-08

Hypothesis Testing

DAT 301 Homework 3

Hypothesis testing helps us use sample data to decide whether a claim about a population is likely to be true.

What is Hypothesis Testing?

Hypothesis testing is a statistical method used to determine whether there is enough evidence to support a claim about a population.

  • Null hypothesis (H₀)
  • Alternative hypothesis (Hₐ)
  • Sample data
  • Statistical decision making

Hypotheses

\[ H_0:\mu = 50 \] \[ H_a:\mu \neq 50 \] Where: - \(\mu\) is the population mean - \(H_0\) is the null hypothesis - \(H_a\) is the alternative hypothesis

Test Statistic

\[ z=\frac{\bar{x}-\mu}{\sigma/\sqrt{n}} \] Where: - \(\bar{x}\) = sample mean - \(\mu\) = population mean - \(\sigma\) = population standard deviation - \(n\) = sample size

Example Problem

A company claims the average wait time is 50 minutes. A sample of 36 customers has an average wait time of 46 minutes. Assume the population standard deviation is 12 minutes. We will test whether the true average wait time differs from 50 minutes.

Solving the Example

\[ z=\frac{\bar{x}-\mu}{\sigma/\sqrt{n}} \] \[ z=\frac{46-50}{12/\sqrt{36}} \] \[ z=-2 \]

P-value

For a z-score of -2, the p-value is approximately 0.0455. Since the p-value is less than 0.05, we reject the null hypothesis. There is evidence that the true average wait time differs from 50 minutes.

Conclusion

Hypothesis testing helps us determine whether sample evidence supports a claim about a population. Key ideas include: - Null hypothesis - Alternative hypothesis - Test statistic - P-value - Statistical decision making

Sample R Code

z <- (46 - 50) / (12 / sqrt(36))
z

ggplot Histogram

data(mtcars)
ggplot(mtcars, aes(x=mpg)) +
  geom_histogram(bins=10)

ggplot Scatterplot

ggplot(mtcars, aes(x=wt, y=mpg)) +
  geom_point()

Plotly Graph

plot_ly(
  data = mtcars,
  x=~wt,
  y=~mpg,
  type="scatter",
  mode="markers"
)