Overview

Understanding Hypothesis Testing

  • Tests a claim against evidence.
  • Wide ranging importance and usefulness in medicine, technology and business.

Why Hypothesis Testing?

  • Used to verify claims or conclude information based on observations and data.

  • Example: A company claims that the average range of their electric vehicle is 300 miles with full charge

  • Use hypothesis testing to evaluate validity of such a claim.

Null / Alternative Hypothesis

  • Null Hypothesis: Original claim, avg range is 300 miles. \[H_0: \mu = 300\]
  • Alternative Hypothesis: Opposing claim, avg range is not 300 miles. \[H_a: \mu \neq 300\]

Test Statistic

  • One sample T-test

\[t = \frac{\bar{x} - \mu_0}{s/\sqrt{n}}\]

  • \(\bar{x}\) = sample mean

  • \(\mu_0\) = hypothesized mean

  • \(s\) = sample standard deviation

  • \(n\) = sample size

Example Data

##      miles      
##  Min.   :255.0  
##  1st Qu.:291.8  
##  Median :314.0  
##  Mean   :309.9  
##  3rd Qu.:331.2  
##  Max.   :346.0

The sample has 20 random range measurements in miles.

Distribution of Data

Boxplot of Data

Interactive View of Data

R Code for T-Test

# Perform one-sample t-test
t.test(range$miles, mu = 300)

Hypothesis Results

## 
##  One Sample t-test
## 
## data:  range$miles
## t = 1.6664, df = 19, p-value = 0.112
## alternative hypothesis: true mean is not equal to 300
## 95 percent confidence interval:
##  297.4656 322.3344
## sample estimates:
## mean of x 
##     309.9

Conclusion

  • The p-value tells us how likely the data is to occur if the Null Hypothesis is true.
  • The t-test evaluates whether the average range of EVs is not 300 miles
  • A p-value below 0.05 would give us evidence to reject the Null Hypothesis.