Skip to content

Instantly share code, notes, and snippets.

@tengpeng
Created February 14, 2015 21:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tengpeng/5ec7134cefb638273b8b to your computer and use it in GitHub Desktop.
Save tengpeng/5ec7134cefb638273b8b to your computer and use it in GitHub Desktop.
Find sample size for given width of confidence interval for contrast in R
find_n = function(ep, g, n, MSE, SSW, w){
n = 4*(qt(1-ep/2, g*(n-1)))^2*MSE*SSW/w^2
return(n)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment