2024-06-01

What is Hypothesis Testing?

Hypothesis Testing is a statistical method used to determine if there is enough evidence in a sample of data to conclude whether or not a hypothesis is true or not regarding a population parameter.

We do this by using the point estimate, \(\bar{x}\), from a random sample.

Null & Alternate Hypothesis

  • \(H_0\) is the null hypothesis, it is almost always shown as an equality
  • \(H_1\) is the alternative hypothesis, it is always ≠, < or >
  • If the test statistic indicates that we do not have evidence in favor of the alternative hypothesis, \(H_1\), the we will fail to reject the null hypothesis, \(H_0\)
  • If the test statistic indicates that we do have evidence in favor of the alternative hypothesis, \(H_1\), the we will reject the null hypothesis, \(H_0\)

Types of Hypothesis Tests

θ represents the population parameter we are interested in testing for: μ, \(s^2\), σ, p

Two-Sided Test: \(H_0\): σ = \(σ_0\) \(H_1\): σ ≠ \(σ_0\)

One-Sided Upper Test: \(H_0\): σ = \(σ_0\) \(H_1\): σ > \(σ_0\)

One-Sided Lower Test: \(H_0\): σ = \(σ_0\) \(H_1\): σ < \(σ_0\)

The P-Value

  • The p-value is the smallest level of significance, α, that causes us to reject \(H_0\)
  • When the p-value is larger then α, we always fail to reject \(H_0\)
  • When the p-value is less then α, we always reject \(H_0\)

Hypothesis Test General Steps

  1. Identify the population parameter of interest (e.g. μ, \(s^2\), σ, p)
  2. Formulate the null hypothesis, \(H_0\)
  3. Determine if we have a two-sided(≠), one-sided upper(>), or one-sided lower(<) from the problem or situation language. Formulate \(H_1\), the alternative hypothesis
  4. Choose a significance level, α (e.g 0.01 or 0.05)
  5. Determine the appropriate test statistic: \(z_0\), \(t_0\), or \(\chi^2_0\)
  6. State the rejection criteria and critical values for the test statistic
  7. Compute the test statistic from the problem data
  8. Draw appropriate conclusions and inference

Example: One-Sample T-Test

Let’s consider a one-sample T-Test example using the following data:

## 
##  One Sample t-test
## 
## data:  data
## t = -0.26299, df = 29, p-value = 0.7944
## alternative hypothesis: true mean is not equal to 5
## 95 percent confidence interval:
##  4.173147 5.638438
## sample estimates:
## mean of x 
##  4.905792

Note that the population, n, is 30, the mean is 5 and the standard deviation is 2

Line Plot of Sample Data

The line plot shows that, while not a perfect curve, the sample data is normally distributed. We can tell because the middle of the curve is what the mean of the data is, which is 5

Histogram of Sample Data

The histogram above also shows that the data is normally distributed, since the count of data of value 5 is the highest

QQ Plot of Sample Data

A QQ plot is used to determine if data follows a given distribution. We can tell our data is normally distributed since the points are grouped together in a straight line