Hypothesis testing

Experimental Design in R

Joanne Xiong

Data Scientist

Breaking down hypothesis testing:

  • Null hypothesis:
    • there is no change
    • no difference between groups
    • the mean, median, or observation = a number
  • Alternative hypothesis:
    • there is a change
    • difference between groups
    • mean, median, or observation is >, <, or != to a number
Experimental Design in R

Power and sample size

  • Power: probability that the test correctly rejects the null hypothesis when the alternative hypothesis is true.
  • Effect size: standardized measure of the difference you're trying to detect.
  • Sample size: How many experimental units you need to survey to detect the desired difference at the desired power.
Experimental Design in R

Power and sample size calculations

library(pwr)
pwr.anova.test(k = 3,
               n = 20,
               f = 0.2,
               sig.level = 0.05,
               power = NULL)
 Balanced one-way analysis of variance power calculation 
               k = 3
              n = 20
              f = 0.2
      sig.level = 0.05
          power = 0.2521043
 NOTE: n is number in each group
Experimental Design in R

Let's practice!

Experimental Design in R

Preparing Video For Download...