Skip to content

Instantly share code, notes, and snippets.

@mikka2061
Last active September 7, 2017 09:58
Show Gist options
  • Save mikka2061/67430ad8830c08f109cbbc438f64dfc0 to your computer and use it in GitHub Desktop.
Save mikka2061/67430ad8830c08f109cbbc438f64dfc0 to your computer and use it in GitHub Desktop.
Let's cheat on our clinical trials in 3 lines of code
n=1000
set.seed(1)
X=rt(n,df=5)
library(ADGofTest)
ad.test(X,pnorm)$p.value
PV=function(n) ad.test(X[1:n],pnorm)$p.value
u=seq(from=1,to=500,by=5)
v=Vectorize(PV)(u)
plot(u,v,type="s",ylim = rev(range(v)),xlab="Sample Size")
abline(h=.05,lty=2,col="red")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment