Skip to content

Instantly share code, notes, and snippets.

@unaoya
Created January 9, 2020 08:11
Show Gist options
  • Save unaoya/99622fb0afff8207bbd1f691cec6c44b to your computer and use it in GitHub Desktop.
Save unaoya/99622fb0afff8207bbd1f691cec6c44b to your computer and use it in GitHub Desktop.
result <- c()
N <- 10000
for(d in 1:100){
ps <- c()
for(i in 1:N){
x <- rt(n = 100, df = d)
ps[i] <- t.test(x, mu = 0)$p.value
}
result[d] <- sum(ifelse(ps < 0.05, 1, 0))
}
result
plot(result)
abline(a=500, b=0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment