1/29/2021

Introduction

  • A Shiny App was created to visualize statistical power as plotted under a Gaussian curve
  • Power is the probability of rejecting the null hypothesis when it is false
  • When designing experiments, more Statistical Power is better
  • Users can manipulate input parameters to visualize the effect on power
  • Power formula: \(P(\frac{mu_a-mu_0}{sigma/\sqrt{n}})\)
    • R code:
z<-qnorm(1-alpha)
pnorm(mu0+z*sigma/sqrt(n),mean = mua,sd = sigma/sqrt(n),lower.tail = FALSE)

User Interface

  • Default input values match those in the Lecture 11 of Johns Hopkins Statistical Inference Coursera Course
  • The plot and calculated power automatically update when new parameters are selected via sliders

Example - Effect of Sample Size

For example, increasing sample size increases statistical power compared to the default parameters

alpha = .05;mu0 = 30;mua = 32;sigma = 4
z<-qnorm(1-alpha)

n = 16
pnorm(mu0+z*sigma/sqrt(n),mean = mua,sd = sigma/sqrt(n),lower.tail = FALSE)
## [1] 0.63876
n = 64
pnorm(mu0+z*sigma/sqrt(n),mean = mua,sd = sigma/sqrt(n),lower.tail = FALSE)
## [1] 0.9907423

Example - Effect of Sample Size (Plot)

Similar code is run in R Markdown to create the plot for n=64